import sys

input = sys.stdin.readline

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

for i in range(N):
    if A[i-1] ^ A[(i+1)%N] != A[i]:
        break
else:
    print("Yes")
    sys.exit()

A = A[::-1]
for i in range(N):
    if A[i-1] ^ A[(i+1)%N] != A[i]:
        break
else:
    print("Yes")
    sys.exit()
print("No")