n = gets.chomp.to_i
h = gets.chomp.split.map(&:to_i)
def f(a)
  max = a.last
  (a.length - 1).downto(1) do |i|
    if (a[i] - max) > 1 then
      puts "No"
      exit
    else
      a[0..i].each do |j|
        if (j - a[i]) > 1 then
          puts "No"
          exit
        end
      end
    end
  end
end
if h.each_cons(2).all? {|a, b| a <= b } or h.length < 2 then
  puts "Yes"
else
  f(h)
  puts "Yes"
end