n = gets.to_i
s_array = gets.chomp.split(" ").map(&:to_i).sort

memo = Hash.new{|hash, key| hash[key] = []}
memo[n] = s_array.pop(1)


now = n
while true do
    if memo[now].empty?
        break if now == 1
        now = n-1
    end

    s = memo[now].pop
    array = s_array.pop(now)
    if array.max == s
        puts "No"
        exit
    end
    (1..now).each do |i|        
        memo[i-1] = [array[i-1]].concat(memo[i-1])
    end
end

puts "Yes"