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

for i in range(N):
    post_index = i + 1 if i + 1 <= (N - 1) else 0
    pre = A[i - 1]
    post = A[post_index]
    if (pre ^ post) != A[i]:
        print("No")
        exit(0)

print("Yes")
