n = int(input())

A = list(map(int, input().split()))
t = 0
for i in range(n-1):
    if A[i-1]^A[i+1] == A[i]:
        continue
    else:
        t = 1
        break
if A[-2] ^ A[0] != A[-1]:
    t = 1
if t:
    print("No")
else:
    print("Yes")