N = int(input())

a = list(map(int,input().split()))

ans = 0
for i in range(1,N-1):
    if((a[i-1] ^ a[i+1])==a[i]):
        ans +=1


if((a[N-1] ^ a[1])==a[0]):
    ans +=1

if((a[N-2] ^ a[0])==a[N-1]):
    ans +=1


if(ans==N):
    print('Yes')
else:
    print('No')