n=gets.to_i
h=gets.split.map(&:to_i)

if n==1
    puts "Yes"
    return
end

cur=0
(n-1).times do |i|
    if h[cur]-h[i+1]>1
        puts "No"
        return
    elsif h[i+1]>h[cur]
        cur=i+1
    end
end
puts "Yes"
