n=int(input())
a=list(map(int,input().split()))
a_2=[]
for i in range(len(a)):
    a_2.append(bin(a[i]))
import collections
c = collections.Counter(a_2)
b=[]
out=0
for i in c.values():
    b.append(i)
if a.count(0)==0:#0がない場合
    if len(b)%3!=0:
        out=1
    for i in range(len(b)-1):
        if b[i]!=b[i+1]:
            out=1
            break
        else:
            pass
    if out==0:
        print('Yes')
    elif out==1:
        print('No')
else:#0あり
    if len(b)>2:
        print('No')
    elif len(b)==1:
        print('Yes')
    elif len(b)==2:
        if a.count(0)*3==len(a):
            print('Yes')
        else:
            print('No')