N = int(input())
a = list(map(int,input().split()))
count = 0
for i in range(N-1):
    b = a[i-1] ^ a[i+1]
    if i == (N-1):
        b = a[i-1] ^ a[0]
        if a[i] != b:
            count += 1
    elif a[i] != b:
        count += 1
if count == 0:
    print('Yes')
else:
    print('No')