
object Main extends App {
  
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt()
  val h = Array.fill(n)(sc.nextInt())
  if (calc(h.length-1)) {
    println("Yes")
  } else {
    println("No")
  }
  
  def calc(i: Int): Boolean = {
    if (i == 0) {
      true
    } else if (i == 1) {
      h(i-1) <= h(1)
    } else if (h(i-1) <= h(i)) {
      calc(i-1)      
    } else if (h(i-1) - 1 == h(i)) {
      h(i-1) = h(i-1) - 1
      calc(i-1)
    } else {
      false
    }
  }
}