N = int(input())

a = list(map(int,input().split()))
a = [a[-1]]+a+[a[0]]
        
Flag = True

for i in range(1,N+1):
    if a[i] != (a[i-1] ^ a[i+1]):
        Flag = False
        break
if Flag:
    print('Yes')
else:
    print('No')