object Main extends App {
  def isNoDown(hs: List[Int]): String = {
    @annotation.tailrec
    def f(l: List[(Int, Int)], before: Int, isDown: Boolean = false): String = l match {
      case h :: t =>
        val diff = h._2 - h._1
        if (diff < 0 && isDown) "No"
        else if (diff < -1) "No"
        else if (before < 0 && diff < 0) "No"
        else f(t, diff, ((before < 0 || isDown) && diff == 0))
      case _ => "Yes"
    }

    f(hs.zip(hs.tail), 0, false)
  }
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt
  val hs = List.fill(n)(sc.nextInt)

  println(isNoDown(hs))
}