n = int(input())
a = list(map(int, input().split()))
cnt = 0

for i in range(0, n-2):
  if a[i+1]*1000000000 == (a[i] ^ a[i+2])*1000000000:
    cnt += 1

if a[0]*1000000000 == (a[1] ^ a[n-1])*1000000000:
  cnt += 1

if a[n-1]*1000000000 == (a[0] ^ a[n-2])*1000000000:
  cnt += 1

if cnt == n:
  print('Yes')
else:
  print('No')