n=int(input())
l=list(map(int,input().split()))
m=max(l)
if m==0:
  print("Yes")
else:
  if n%3!=0:
    print("No")
  else:
    l2=set(l)
    l1=[]
    for i in l2:
      l1.append(i)
    if len(l1)!=3:
      print("No")
    else:
      a=l1[0]
      b=l1[1]
      c=l1[2]
      l=sorted([a,b,c])
      m=l[2]
      l2=[]
      while m!=0:
        l2.append(m%2)
        m=m//2
      m1=l[1]
      l1=[]
      while m1!=0:
        l1.append(m1%2)
        m1=m1//2
      m0=l[0]
      l0=[]
      while m0!=0:
        l0.append(m0%2)
        m0=m0//2
      while len(l0)<len(l2):
        l0.append(0)
      while len(l1)<len(l2):
        l1.append(0)
      b=True
      for i in range(len(l2)):
        if l0[i]+l1[i]+l2[i]!=2 and l0[i]+l1[i]+l2[i]!=0:
          b=False
      if b:
        print("Yes")
      else:
        print("No")