from collections import defaultdict

N = int(input())
A = list(map(int, input().split()))

a0 = A[0]
a1 = A[1]
a2 = a0 ^ a1

f = True

for i in range(3, N):
    if i % 3 == 0 and a0 != A[i]:
        f = False
    elif i % 3 == 1 and a1 != A[i]:
        f = False
    elif i % 3 == 2 and a2 != A[i]:
        f = False

if f:
    print('Yes')
else:
    print('No')
