n = int(input())
if n%3 !=0:
  print('No')
  exit()
A = list(map(int,input().split()))
from collections import Counter
A = list(Counter(A).most_common())

B = []
for a,c in A:
  if c != n//3:
    print('No')
    exit()
  B.append(a)
n = len(str(max(B)))
  
B = [[(1<<j&i)>>j for j in range(30)] for i in B]
for i in range(30):
  if B[0][i]^B[1][i]^B[2][i] != 0:
    print('No')
    break
else:
  print('Yes')