import sys

N = int(input().strip())
a_list = [int(i) for i in input().split()]

for i in range(N):
    if i == 0:
        a = bin(a_list[N-1])
        b = bin(a_list[i+1])
    elif i == N-1:
        a = bin(a_list[i-1])
        b = bin(a_list[0])
    else:
        a = bin(a_list[i-1])
        b = bin(a_list[i+1])
    c = int(a, 0) ^ int(b, 0)
    if c != a_list[i]:
        print("No")
        sys.exit()
print("Yes")