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