n = int(input())
ai = list(map(int, input().split()))
yes = 1

for i in range(n):
  if i == 0:
    if (ai[1] ^ ai[n-1]) != ai[0]:
      yes = 0
  elif i == n-1:
    if (ai[0] ^ ai[n-2]) != ai[n-1]:
      yes = 0
  else:
    if (ai[i-1] ^ ai[i+1]) != ai[i]:
      yes = 0
if yes == 0:
  print('No')
else:
  print('yes')