# coding: utf-8
# Your code here!
n=int(input())
a=list(map(int,input().split()))
c=max(a)
cnt=1
cc=[]
for i in range(n):
    for j in range(100):
        if a[i]<2**j:
            cc.append(j)
            break
if max(cc)-min(cc)==1:
    print('Yes')
else:
    print('No')
#print(cc)

