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

f = 0
if a[0] == a[-1]^a[1]:
  if a[n-1] == a[n-2]^a[0]:
    for i in range(1,n-1):
      if a[i] == a[i-1]^a[i+1]:
        continue
      else:
        f = 1
        break
  else:
    f = 1
else:
  f = 1

if f == 0:
  print("Yes")
else:
  print("No")