N=int(input())
A=list(map(int, input().split())) 
A.sort()
ONE=0
TWO=0
THREE=0
AA=A[0]
BB=A[N//3]
CC=A[(N*2)//3]
AAA=bin(AA)
BBB=bin(BB)
CCC=bin(CC)
X=bin(AA^BB)
Y=bin(BB^CC)
Z=bin(CC^AA)
if X==CCC and Y==AAA and Z==BBB:
    if N%3==0:
        for x in range(0,N):
            if AA==A[x]:
                ONE=ONE+1
            if BB==A[x]:
                TWO=TWO+1
            if CC==A[x]:
                THREE=THREE+1
        if ONE==TWO and TWO==THREE and THREE==N//3:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")

