def xor(n1, n2):
  if n2=="0":
    return n1
  elif n2=="1":
    if n1=="1":
      return "0"
    else:
      return "1"
      
def bitxor(n1, n2):

  bn1 = bin(n1)[2:]
  bn2 = bin(n2)[2:]
  if n1<n2:
    bn1 = bn1.zfill(len(bn2))
  else:
    bn2 = bn2.zfill(len(bn1))
    
  n3 = [xor(b1,b2) for b1,b2 in zip(bn1, bn2)]
  n3 = "".join(n3)
  return int(n3, 2)


n = int(input())
a = [int(x) for x in input().split()]
a_unique = list(set(a))
la = len(a)
lau = len(a_unique)


if a_unique==[0]:
  print("Yes")

elif la%3==0 and a_unique==[0,1] or a_unique==[1,0]:
  u0 = a.count(0)
  u1 = a.count(1)
  if u0*2==u1:
    print("Yes")
elif la%3!=0 or lau!=3:
  print("No")
else:
  u0 = a.count(a_unique[0])
  u1 = a.count(a_unique[1])
  u2 = a.count(a_unique[2])

  if (a_unique[2]== bitxor(a_unique[0], a_unique[1])) and (u0==u1 and u1==u2):
    print("Yes")
  else:
    print("No")
