from collections import deque
n = int(input())
L = list(map(int,input().split()))
L = deque(L)
L.append(L[0])
L.appendleft(L[n-1])
#print(L)
flag = False
for i in range(n):
    if L[i]^L[i+2] == L[i+1]:
        flag = True
    else:
        print("No")
        exit()
if flag:
    print("Yes")