fun main(arg: Array<String>) {
    val N = nextInt()
    val H = listOfInt()
    var h = Int.MAX_VALUE
    for (n in (0 until N).reversed()) {
        if (H[n] <= h) h = H[n]
        else if (H[n] - 1 == h) h = H[n] - 1
        else {
            println("No")
            return
        }
    }
    println("Yes")
}
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun listOfString() = next().split(" ")
fun listOfInt(delta: Int = 0) = listOfString().map { Integer.parseInt(it) + delta }
