n = input()
n = int(n)
a = input().split()
a = [int(i) for i in a]
a.append(a[0])
a.append(a[1])
c = 1
for i in range(n):
  if a[c-1] ^ a[c+1] == a[c]:
    c += 1
  else: 
    print('No')
    break
if c == n+1:
  print('Yes')