n = gets.to_i

hs = gets.split.map(&:to_i)

res = "Yes"
hs.each_with_index do |i, 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
        res = "No"
        break
    end
    if next_n < i
        if i - 1 < last_n
            res = "No"
            break
        end
        hs[idx] -= 1
    end
end

puts res
