N = int(input())
n = list(map(int, input().split()))
t = 0
for i in range(N):
  if i == 0:
    if n[N-1] ^ n[1] == n[0]:
      t += 1
  elif i == N-1:
    if n[N-2] ^ n[0] == n[N-1]:
      t += 1
  else:
    if n[i-1] ^ n[i+1] == n[i]:
      t += 1
if t == N:
  print("Yes")
else:
  print("No")
