INF = 10**10
n = gets.to_i
a = gets.split.map(&:to_i)
a.sort_by!{|v| -v}
cur = [a[0]]
flg = true
n.times do |i|
  a.sort_by!{|v| -v}
  cur.sort_by!{|v| -v}
  m = 2**i
  j,k = 0,0
  while j < 2**n && k < m
    if cur[k] > a[j]
      cur << a[j]
      k += 1
      a[j] = INF
    end
    j += 1
  end
  flg = false if cur.length != 2*m
end
puts flg ? "Yes" : "No"