'use strict';

function main(input) {
  const lines = input.split('\n');
  lines.pop();
    const n = parseInt(lines[0], 10);
    const array = lines[1];
    console.log(fn(n, array));
}

function fn(n, array) {
  const a = array.split(' ').map(v => parseInt(v, 10));
  const max = Math.max.apply(null, a);
  const idx = a.indexOf(max);
  if (idx < n - 1) {
    return 'No';
  }
  let c = 0;
  while (c < n -1) {
    const current = a[c],
      next = a[c+1];
    if ((current - 1) > next) {
      return 'No';
    }
    c++;
  }
  return 'Yes';
}

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