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

    def g(l: List[(Int)], before: Int, isDown: Boolean): String = {
      l match {
        case h :: t =>
          val diff = h - before
          if (diff < 0) {
            if (isDown) "No"
            else g(t, h, true)
          }
          else g(t, h, false)
        case _ => "Yes"
      }
    }

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

  println(isNoDown(hs))
}