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

    print(abc136c(y))
}

fun abc136c(y: List<Int>): String {

    var ans = "Yes"
    var max = y[0]

    for (i in 0 until y.size - 1) {
        if (((y[i] - y[i + 1]) > 1) || (((y[i] - y[i + 1]) == 1) && max > y[i + 1])) {
            ans = "No"
            break
        } else if ((y[i] - y[i + 1]) == 1) {
            max = y[i] - 1
        }
    }
    return ans
}
