n = gets.strip.to_i
h = gets.strip.split.map(&:to_i)

h.unshift(0)
h[h.length] = 10**9

flag = true
(1..h.length-2).each do |i|
  l = h[i-1]
  c = h[i]
  r = h[i+1]
  # puts "#{l} : #{c} : #{r}"
  if r <= c
    if r != c 
      if c - r == 1
        if (c-l)-(c-r) >= 0
          h[i] -= 1
        else
          flag = false
        end
      else
        flag = false
      end 
    end
  else
    h[i+1] -= 1
  end
  if flag == false
    puts 'No'
    exit 0
  end
end
puts 'Yes'