N = int(input())
a = list(map(int, input().split()))
broke = False
if a[0] != a[N-1] ^ a[1]:
    broke = True
    print('No')
elif a[N-1] != a[0] ^ a[N-2]:
    broke = True
    print('No')
if broke == False:
    for i in range(1,N-1):
        if a[i] != a[i-1] ^ a[i+1]:
            broke = True
            print('No')
            break
if broke == False:
    print('Yes')