'use strict';
const main = x => {
  const n = parseInt(x[0], 10);
  const h = x[1].split(' ').map(val => parseInt(val, 10));
  // console.log(n, h);
  let count = 0;
  let ans = 1;
  for(let i=0; i<n-1; i++) {
    if (h[i]-h[i+1]>2) ans = 0;
    else if (h[i]-h[i+1]==1) {
      if (count == 1) ans = 0;
      else count++;
    } 
  }
  console.log(ans?'Yes':'No');
  
};
main(require("fs").readFileSync("/dev/stdin", "utf8").split('\n'));