n = int(input())
a = [int(x) for x in input().split()]

f = 0
if a[0] != a[-1]^a[1]:
  f = 1
elif a[n-1] != a[n-2]^a[0]:
  f = 1
else:
  for i in range(1,n-1):
    if a[i] != a[i-1]^a[i+1]:
      f = 1
      break
        
if f == 0:
  print("Yes")
else:
  print("No")