n=int(input())
A=map(int,input().split())
a=list(A)
s=0


for i in range(0,n-2):
    if  (bin(a[i] ^ a[i+2]))==bin(a[i+1]):
        continue
    else:
        s=1

if  (bin(a[n-1] ^ a[1]))==bin(a[0]):
    f=0
else:
    s=1

if  bin((a[n-2] ^ a[0]))==bin(a[n-1]):
    f=0
else:
    s=1

if s==1:
    print('No')
else:
    print('Yes')
