n=int(input())
A=list(map(int,input().split()))
A.append(A[0])
A.append(A[1])
d=0

# for i in range(0,n):
#     a=str(bin(A[i]))
#     b=str(bin(A[i+2]))
#     print(a)
#     print(b)
#     c=bin("a"^"b")
#     if int(bin(c,2))==int(A[i+1]):
#        d=d+1
for i in range(0,n):
    if bin(A[i]^A[i+2])==bin(A[i+1]):
       d=d+1
if d==n:
    print("Yes")
else:
    print("No")

