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

for i in range(-2, N-2):
    x=int(bin(A[i] ^ A[i+2]), 0) -A[i+1]
    if not x == 0:
        flag=1
    if flag ==1:
        break
if flag==0:
    print("Yes")
else:
    print("No")