n = int(input())
a = list(map(int, input().split()))
for i in range(n-1):
    if a[i] != a[i-1] ^ a[i+1]:
        print('No')
        exit()
if a[n-1] != a[0] ^ a[n-2]:
    print('No')
    exit()
print('Yes')
