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

for i in range(N):
    a = i - 1 if i - 1 >= 0 else -1
    b = i + 1 if i + 1 < N else 0
    if (A[a] ^ A[b]) != A[i]:
        print("No")
        exit()
print("Yes")