// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
    input = input.split("\n");
    // 数値の配列を作る
    const numList0 = input[0].split(' ').map(x => parseInt(x, 10));
    const N = numList0[0];
    const HList = input[1].split(' ').map(x => parseInt(x, 10));
 
    var current = HList[0];
    var flag = true;
  	var max = 0;
    for (var i = 1; i < N; i++) {
        var next = HList[i];
        if (current <= next) {
          	max = current;
	        current = next;
        } else if (current - 1 === next && max <= next) {
          	current = next;
          	max = current;
        } else {
            flag = false;
            break;
        }
    }
 
    if (flag) {
        console.log('Yes');
    } else {
        console.log('No');
    }
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));