N = gets.to_i
Ss = gets.split.map(&:to_i)
INF = 10**9 + 5
M = 1 << N

def born?(xs, ss)
  i = 1
  ys = xs.dup
  xs.reverse_each do |x|
    if i = (i ... M).find{|j| ss[j] < x}
      ys << ss[i]
      ss[i] = INF
    else
      puts 'No'
      exit
    end
  end
  return true if ys.size == M
  born?(ys.sort, ss)
end

ss = Ss.sort.reverse
xs = ss[0, 1]
ss[0] = INF
puts born?(xs, ss) ? 'Yes' : 'No'