N = gets.to_i
H = gets.split.map(&:to_i)
R = []

N.times do |n|
  if H[n+1].nil?
    R << H[n]
    break
  end
  
  if H[n] > H[n+1]
    R << H[n] - 1
  else
    R << H[n]
  end
end

result = true

R.each_cons(2) do |r|
  if r[0] > r[1]
    result = false
    break
  end
end

puts result ? 'YES' : 'NO'