n=input()
n=int(n)
a=list(map(int,input().split()))
ans="Yes"
if n%3!=0:
  ans="No"
c=0
i=1
while 2**i<max(a):
  c=0
  for j in range(n):
    
    if (a[j]//(2**(i-1)))%(2**i)==1:
      c+=1
  if c!=n/3*2:
    ans="No"
    break
  i+=1
print(ans)