N=int(input())
x=list(map(int,input().split()))
answer = "Yes"
for i in range(N) :
    if i == N-1:
        wk = bin(x[i-1] ^ x[0])
    else:
        wk = bin(x[i-1] ^ x[i+1])
    if x[i] != int(wk,2):
        answer = "No"
        break
print(answer)