N = int(input())
num = list(map(int,input().split()))
c = True
lim = 10 ** 6
nn = num[-1::lim]+num+num[0::lim]
for i in range(1,N+1):
  if (nn[i-1] ^ nn[i+1]) != nn[i]:
    c = False
    break
if c:
  print("Yes")
else:
  print("No")
