N = gets.to_i
Ss = gets.split.map(&:to_i)

def born(xs, ys)
  return true if ys.empty?
  xs.zip(ys).all?{|x, y| x > y} ? born((xs + ys.take(xs.size)).sort.reverse, ys.drop(xs.size)) : false
end

puts born([Ss.max], Ss.sort.reverse.drop(1)) ? 'Yes' : 'No'