n = int(input())

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

A.append(A[0])
A.append(A[-2])
t = 0
for i in range(n):
    if A[i - 1] ^ A[i + 1] != A[i]:
        t = 1
        break
if t:
    print("No")
else:
    print("Yes")