fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val H = readLine()!!.split(" ").map{it.toInt()}.toTypedArray()

    for (i in H.indices.reversed()) {
        if (i == 0) continue
        if (H[i - 1] > H[i]) {
            H[i - 1]--
        }
    }

    println(if (H.mapIndexed { index, h -> index == H.size - 1 || H[index] <= H[index + 1] }.all {it}) "Yes" else "No")
}
