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

ans = 'Yes'

for i in range(n-1):
    # print(a[i-1],a[i],a[i+1])
    if bin(a[i]) == bin(a[i-1] ^ a[i+1]):
        pass
    else:
        ans = 'No'
        break

# if ans == 'Yes':
#     print(a[n-2],a[n-1],a[0])
if bin(a[n-1]) == bin(a[n-2] ^ a[0]):
    pass
else:
    ans = 'No'

print(ans)
