
N = int(input())

a = list(map(int, input().split()))

isPuttable = True

for i in range(0, N):
  if a[i] != (a[(i-1)%N] ^ a[(i+1)%N]):
    isPuttable = False
    
if isPuttable:
  print('YES')
else:
  print('NO')