
fun main(args:Array<String>) {
    val itemCount = readLine()!!.toInt()
    val items = readLine()!!.split(" ").map { it.toLong() }.toMutableList()
    val itemsMin = (1..itemCount).map { Long.MAX_VALUE }.toMutableList()
    itemsMin[items.lastIndex] = items.last()
    for(i in (0 until items.lastIndex).reversed()) {
        itemsMin[i] = Math.min(itemsMin[i + 1], items[i])
    }
    var ans = "Yes"
    items[0] = items[0] - 1
    for(i in (1 until items.size)) {
        if(items[i-1] > items[i]) {
            ans = "No"
            break
        }
        if(items[i-1] == items[i]) {
            continue
        }
        items[i] = items[i] - 1
        if(items[i] > itemsMin[i]) {
            ans = "No"
            break
        }
    }
    println(ans)

}

