import sys 
import numpy as np

N = int(input())
a = np.array(list(map(int, input().split())))
a = np.insert(a, 0, a[-1])
a = np.append(a, a[1])


for i in range(1,N):
    A = a[i-1]
    B = a[i+1]
    AB = A ^ B
    if AB != a[i]:
        print('No')
        sys.exit()

print('Yes')
