object Main extends App {
  import scala.io.StdIn._
  val n = readInt()
  val h = readLine().split(" ").map(_.toInt)
  var c = 0
  for(i <- (0 until(n-1))){
    if(h(i) > h(i+1)){
      c += 1
    }
    if(h(i) > h(i+1) + 1){
      c += 1
    }
  }
  println(if(c > 1) "No" else "Yes")
}