


object Main extends App {

  var n = scala.io.StdIn.readLine.toInt
  val hArr = scala.io.StdIn.readLine.split(" ").map(_.toLong)

  def solve(): String = {
    var max = 0L
    for(i <- 0 until n-1) {
      if(hArr(i+1) > hArr(i)) max = Math.max(max, hArr(i)-1)
      else if(hArr(i+1) == hArr(i)) max = Math.max(max, hArr(i))
      else return "No"
    }
    "Yes"
  }
  println(solve)
}
