  YES = 'Yes'
  NO = 'No'

  n = gets.to_i
  a = gets.split.map(&:to_i)

  b = []
  n.times do
    num = a.shift
  if a.find{|n| n < num}
      num -= 1
    end
    b.push(num)
  end
  r = YES
  b.each_with_index do |num, i|
    next_num = b[i+1]
    if next_num.nil?
      print r
      break
    end
    if num > next_num
      r = NO
    end
  end
