n = input()
a = list(map(int, input().split()))
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])
rev = []
rev.append(res[0])
hoge = res[1:]
hoge.reverse()
rev.extend(hoge)

mes = "Yes"
for i, j in enumerate(res):
  if(i+1 != j):
    mes = ("No")
mes1 = "Yes"
for i, j in enumerate(rev):
  if(i+1 != j):
    mes1 = ("No")
if(mes == "Yes" || mes1 == "Yes"):
  print("Yes")
else:
  print("No")