fun main(args: Array<String>) {
    readLine()
    val hl = readLine()!!.split(" ").map { it.toLong() }
//    val hl = "1 2 1 1 3".split(" ").map { it.toLong() }

    var curMax = 0L
    var modified = false

    hl.forEach { h ->
        val distance = h - curMax
//        println("$curMax, $h, $distance, $modified")
        if (distance <= -2L) {
            print("No")
            return
        } else if (distance == -1L) {
            if (modified) {
                print("No")
                return
            } else {
                modified = true
                curMax = h
            }
        } else if (distance >= 1L) {
            if (modified) {
                if (distance >= 2L) {
                    curMax = h
                    modified = false
                }
            } else {
                curMax = h
            }
        }
    }
    print("Yes")
}
