import math
n=int(input())
A=[int(i) for i in input().split()]
B=[bin(i)[2:] for i in A]
maxA=max(A)
if maxA != 0:
    bigB=math.ceil(math.log2(maxA))
else:
    bigB=0
B=[i.zfill(bigB) for i in B]

nn=0
ls=[]
cn=[0,0,0]


if n>=3:
    if not n//3*3 == n:
        if maxA ==0:
            print("Yes")
        else:
            print("No")
    else:
        for q in B:
            if q not in ls:
                if len(ls)>=3:
                    print("No")
                    break
                ls.append(q)
                cn[cn.index(0)]+=1
            else:
                cn[ls.index(q)]+=1

        else:
            ls.append(0)
            ls.append(0)
            per=0
            for i in range(bigB):
                per+=10**1
            if not 0 in cn:
                ls=[int(i) for i in ls[:3]]
                if "1" in str(sum(ls)).zfill(bigB):
                    print("No")
                elif "3" in str(sum(ls)).zfill(bigB):
                    print("No")
                else:
                    if cn[0]==cn[1] and cn[1]==cn[2]:
                        print("Yes")
                    else:
                        print("No")
            else:
                if cn[1]==0:
                    cn=[3,0,0]
                    ls=[int(ls[i])*cn[i] for i in range(3)]
                    if "1" in str(sum(ls)).zfill(bigB):
                        print("No")
                    elif "3" in str(sum(ls)).zfill(bigB):
                        print("No")
                    else:
                        if (cn[0]==cn[1]*2 or cn[0]*2==cn[1] or cn[1]==0):
                            print("Yes")
                        else:
                            print("No")
                elif (cn[0]==cn[1]*2 or cn[0]*2==cn[1] or cn[1]==0):
                    cn=[2,1,0]
                    ls=[int(ls[i])*cn[i] for i in range(3)]
                    if "1" in str(sum(ls)).zfill(bigB):
                        print("No")
                    elif "3" in str(sum(ls)).zfill(bigB):
                        print("No")
                    else:
                        if (cn[0]==cn[1]*2 or cn[0]*2==cn[1] or cn[1]==0):
                            print("Yes")
                        else:
                            print("No")
                else:
                    print("No")