n = gets.to_i

hs = gets.split.map(&:to_i)
processed = Array.new(n, false)

res = "Yes"
(n-1).downto(0) do |idx|
    i = hs[idx]
    last_n = idx == 0 ? 0 : hs[idx - 1]
    next_n = idx == hs.size - 1 ? 10**9 + 1 : hs[idx + 1]
    if i < last_n - 1
        res = "No"
        break
    end
    if i == last_n - 1
        hs[idx - 1] -= 1
        next
    end
end

puts res
