n = gets.to_i
array = readline.split(' ').map(&:to_i)

flag = false
ans = 'No'

array.each_with_index do |e, i|
  if i == array.size - 1
    break
  end

  unless flag
    if e > array[i + 1]
      if e - array[i + 1] > 1
        ans = 'No'
        break
      end
      array[i + 1] = array[i + 1] + 1
      flag = true
      next
    end
  end

  if e > array[i + 1]
    ans = 'No'
    break
  end

  ans = "Yes"
end
if n == 1
  ans = "Yes"
end
puts ans
