n = gets.strip.split(' ').map(&:to_i)[0]
h = gets.strip.split(' ').map(&:to_i)

ans = "Yes"
max_prev = 0
(1..n).each do |num|
    if h[num-1] < max_prev-1 then
        ans = "No"
        break
    end
    if h[num-1] > max_prev then
        max_prev = h[num-1]
    end
end
puts(ans)