N = int(input())
A = list(map(int, input().split()))

for i in range(0, len(A) - 2):
    if A[i] ^ A[i + 1] ^ A[i + 2]:
        print("No")
        exit(0)

if (A[0] ^ A[1] ^ A[-1]) or (A[0] ^ A[-1] ^ A[-2]):
    print("No")
else:
    print("Yes")
