N = int(input())
num = list(map(int,input().split()))
c = True
nn = num[-1::len(num)]+num+num[0::len(num)]
for i,j in enumerate(nn[1:len(nn)-1]):
  if nn[i] ^ nn[i+2] != nn[i+1]:
    c = False
    break
    
if c:
  print("Yes")
else:
  print("No")