n = gets.to_i
ns = gets.chomp.split(' ').map(&:to_i)

r = 'Yes'
count_minus1 = 0
0.upto(n - 2) do |i|
    diff = ns[i + 1] - ns[i]
    if diff <= -2
        r = 'No'
        break
    end
    if diff == -1
        count_minus1 += 1
        if count_minus1 >= 2
            r = 'No'
            break
        end
    end
end

puts r