#!/bin/env ruby
#

s = STDIN.readlines

n = s[0].to_i
h = s[1].split(" ").map(&:to_i)

thre = h[0]
flag = true
count = 0

0.upto(h.size - 2) do |i|
  if (h[i] - h[i+1]) > 1
    puts "No"
    exit
  elsif (h[i] - h[i+1]) == 1
    if !flag
      puts "No"
      exit
    end
    h[i] = h[i] - 1
  else
    flag = true
  end
end

if h.size != 1 && (h[-1] != h.sort[-1])
  puts "No"
  exit
end

puts "Yes"
