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

import collections
At=collections.Counter(A)

Alist=At.most_common()

if len(Alist)!=3:
    print("No")
    exit()
elif not Alist[0][1]==Alist[1][1]==Alist[2][1]:
    print("No")
    exit()

Anum=[Alist[0][0],Alist[1][0],Alist[2][0]]
Anum.sort()

Astr=[""]*3
for i in range(3):
    temp=Anum[i]
    while temp>1:
        Astr[i]+=str(temp//2)
        temp%=2
    if temp==1:
        Astr[i]+="1"
    else:
        Astr[i]+="0"

SL=len(Astr[2])
for i in range(3):
    Astr[i]=Astr[i].zfill(SL)

temp=""
for i in range(SL):
    if Astr[0][i]==Astr[2][i]:
        temp+="0"
    else:
        temp+="1"
if temp!=Astr[1]:
    print("No")
    exit()

temp=""
for i in range(SL):
    if Astr[1][i]==Astr[0][i]:
        temp+="0"
    else:
        temp+="1"
if temp!=Astr[2]:
    print("No")
    exit()
temp=""
for i in range(SL):
    if Astr[1][i]==Astr[2][i]:
        temp+="0"
    else:
        temp+="1"
if temp!=Astr[0]:
    print("No")
    exit()
print("Yes")
