# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))
B = []
B.append(A[-1])
for a in A:
    B.append(a)
B.append(A[0])
ans = "Yes"

for a, b, c in zip(B, B[1:], B[2:]):
    if a ^ c == b:
        continue
    else:
        ans = "No"
        break
print(ans)
