function main(input) {
    const args = input.split('\n');
    const N = args[0];
    const H = args[1].split(' ');
    var flag = 'Yes';
    var jadge = false;
    for(var i = 1; i < N ; i++) {
        var Hi = parseInt(H[i], 10);
        var Him = parseInt(H[i-1], 10);



        if( Him <= Hi ){
            flag = 'Yes'
        } else {
            if(Him - Hi === 1 && jadge) {
                flag = 'Yes';
            } else {
                flag = 'No';
            }
        }
        if(Hi === Him){
            jadge= false;
        }else {
            jadge = true;
        }
        if (flag === 'No' ) break;
    }
    console.log(flag);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
