import sys

N = int(input())
a = list(map(int, input().split()))
ah = a.copy()
a.append(a[0])

for i in range(N):
    if i == 0:
        if bin(a[N-1] ^ a[i+1]) == bin(a[i]):
            ah.remove(a[i])
            continue

    else:
        if bin(a[i-1] ^ a[i+1]) == bin(a[i]):
            ah.remove(a[i])
            continue

if ah == []:
    print("Yes")
else:
    print("No")