N = gets.to_i
Hs = gets.split.map(&:to_i)
ans = "Yes"

Hs.reverse!

if N > 1
    pre = Hs[0]
    for i in 1...N do
        if pre == Hs[i]
            next
        elsif pre < Hs[i]
            if pre == Hs[i] - 1
                pre = Hs[i] - 1
                next
            else
                ans = "No"
                break
            end
        else
            pre = Hs[i]
            next
        end
    end
end

puts ans