N = int(input())
A = list(map(int, input().split()))
C = [A[-1]] + A + [A[0]]

flag = True
for i in range(1, N+1):
  xor = C[i-1] ^ C[i+1]
  if i != xor:
    flag = False
    break

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