N = int(input())
A = input().split()
for i in range(N):
  A[i] = int(A[i])
  
A_unique = list(set(A))
A_digit = [[],[],[]]
if A == [0] * N:
  ans = 'Yes'
elif len(A) %3 != 0:
  ans ='No'
elif len(A_unique) == 1:
  ans = 'No'
elif len(A_unique) == 2:
  if min(A_unique) ==0 and A.count(0) == N/3:
    ans = 'Yes'
else:
  for j in range(3):
    A_unique[j] = format(A_unique[j], '08b').zfill(30)
    s = str(A_unique[j])
    A_digit[j]  = list(map(int, s))
  for k in range(30):
    key = A_digit[0][k] + A_digit[1][k] + A_digit[2][k] 
    if key == 0 or key == 2:
      ans = 'Yes'
    else:
      ans = 'No'
      break

print(ans)