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

ss = Ss.sort.reverse
ps = [ss[0]]; ss[0] = INF
N.times do
  ps1 = ps.dup
  ps.reverse_each do |p|
    if i = ss.bsearch_index{|s| s < p}
      ps1 << ss[i]; ss[i] = INF
    else
      puts 'No'; exit
    end
  end
  ps = ps1.sort
end
puts 'Yes'