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

flg = True
for i in range(len(line)):
  max = i + 1
  min = i - 1
  if i + 1 > n - 1:
    max = 0
  elif i - 1 < 0:
    min = n - 1
  wa = line[min] ^ line[max]
  if line[i] != wa:
    flg = False

if flg:
  print('Yes')
else:
  print('No')

