n = read_line.to_i
a = read_line.split.map(&.to_i)
h = Hash(Int32, Int32).new
a.each do |v|
  if h.has_key?(v)
    h[v] += 1
  else
    h[v] = 1
  end
end
ans = if h.size == 3 && h.values.all? { |v| v == n / 3 }
        ks = h.keys.to_a
        ks[0] ^ ks[1] == ks[2]
      else
        false
      end
puts ans ? "Yes" : "No"
