#!/bin/bash

read n
read in1
h=(${in1// / })
for ((i=n-1; i>0; i--)); do
  k=$((h[i-1]-h[i]))
  if [ $k -gt 1 ]; then
    echo "No"
    exit
  elif [ $k -eq 1 ]; then
    h[$i-1]=$((h[i-1]-1))
  fi
done
echo "Yes"