fun main() {
    val n= readLine()!!.toInt()
    val h= readLine()!!.split(" ").map { it.toInt() }.toIntArray()
    var now=0
    for (i in 0 until h.size){
        if (i==0){now=h[0]-1}
        else{
            if (now<h[i]){now=h[i]-1}
            if (now==h[i]){continue}
            if (now>h[i]){now=-1;break}
        }
    }
    if (now==-1){
        println("No")
    }else{
        println("Yes")
    }
}