A = int(input())
B =list(map(int,input().split()))
for i in range(len(B) - 1):
    if i == 0 :
        continue
    if bin(B[i -1] ^ B[i +1])  == bin(B[i]):
        print("Yes")
        exit()
    else:
        print("No")
        exit()
