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

a.reverse()
res = []
for n in range(len(a)):
  if(n == (len(a) - 1)):
    res.append(a[n - 1]^a[0])
  else:
    res.append(a[n - 1]^a[n + 1])

mes = "Yes"
for i, j in enumerate(res):
  if(a[i] != j):
    mes = ("No")
print(mes)