var input = require("fs").readFileSync("/dev/stdin", "utf8").split("\n");
var total = parseInt(input[0], 10);
var nums = input[1].split(" ").map(function(num) {
  return parseInt(num, 10);
});

var can = true;

var minus = 0;
for (var i = 0; i < total; i++) {
  var next = nums[i + 1];
  if (typeof next === 'undefined') {
    continue;
  }

  var diff = nums[i] - next;
  if (diff > 1) {
    can = false;
    break;
  }
  if (diff === 1) {
    minus++;
  }
  prev = nums[i];
}

if (minus > 1) {
  can = false;
}

console.log(can ? 'Yes' : 'No');
