N=int(input())
a=[int(x) for x in input().split()]
for i in range(N-2):
    if not a[i]^a[i+2]==a[i+1]:
        print('No')
        exit()
if not a[-2]^a[0]==a[-1]:
    print('No')
    exit()
if not a[-1]^a[1]==a[0]:
    print('No')
    exit()
print('Yes')