n = int(input())
lst = list(map(int,input().split()))

flg = 1
for i in range(len(lst)):
  if i+1 == len(lst):
    if bin(lst[i]) != bin(lst[i-1] ^ lst[0]):
      flg = 0
      break
  elif bin(lst[i]) != bin(lst[i-1] ^ lst[i+1]):
    flg = 0
    break
if flg == 1:
  print("Yes")
else:
  print("No")
    
