import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int array[] = new int[N];
    for (int i=0;i<N;i++){
      array[i] = sc.nextInt();
    }
    boolean possible = true;
    int nowarray = array[0];
    for (int i=0;i<N;i++){
      if (nowarray+1 <array[i]){
        nowarray = array[i]-1;
    }
      if (nowarray>array[i]){
        possible = false;
      }
    }
    if(possible){
     System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
} import java.util.*; util.* java class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int array[] = new int[N];
    for (int i=0;i<N;i++){
      array[i] = sc.nextInt();
    }
    boolean possible = true;
    int nowarray = array[0];
    for (int i=0;i<N;i++){
      if (nowarray+1 <array[i]){
        nowarray = array[i]-1;
    }
      if (nowarray>array[i]){
        possible = false;
      }
    }
    if(possible){
     System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int array[] = new int[N];
    for (int i=0;i<N;i++){
      array[i] = sc.nextInt();
    }
    boolean possible = true;
    int nowarray = array[0];
    for (int i=0;i<N;i++){
      if (nowarray+1 <array[i]){
        nowarray = array[i]-1;
    }
      if (nowarray>array[i]){
        possible = false;
      }
    }
    if(possible){
     System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  } main {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int array[] = new int[N];
    for (int i=0;i<N;i++){
      array[i] = sc.nextInt();
    }
    boolean possible = true;
    int nowarray = array[0];
    for (int i=0;i<N;i++){
      if (nowarray+1 <array[i]){
        nowarray = array[i]-1;
    }
      if (nowarray>array[i]){
        possible = false;
      }
    }
    if(possible){
     System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int array[] = new int[N]; array new int[N] N for (int i=0;i<N;i++){
      array[i] = sc.nextInt();
    } int i=0; int i=0; i 0 i<N i N i++ i++ i {
      array[i] = sc.nextInt();
    } {
      array[i] = sc.nextInt();
    } array[i] = sc.nextInt() array[i] array i sc.nextInt() sc.nextInt sc boolean possible = true; possible true int nowarray = array[0]; nowarray array[0] array 0 for (int i=0;i<N;i++){
      if (nowarray+1 <array[i]){
        nowarray = array[i]-1;
    }
      if (nowarray>array[i]){
        possible = false;
      }
    } int i=0; int i=0; i 0 i<N i N i++ i++ i {
      if (nowarray+1 <array[i]){
        nowarray = array[i]-1;
    }
      if (nowarray>array[i]){
        possible = false;
      }
    } {
      if (nowarray+1 <array[i]){
        nowarray = array[i]-1;
    }
      if (nowarray>array[i]){
        possible = false;
      }
    } if (nowarray+1 <array[i]){
        nowarray = array[i]-1;
    } nowarray+1 <array[i] nowarray+1 nowarray 1 array[i] array i {
        nowarray = array[i]-1;
    } nowarray = array[i]-1 nowarray array[i]-1 array[i] array i 1 if (nowarray>array[i]){
        possible = false;
      } nowarray>array[i] nowarray array[i] array i {
        possible = false;
      } possible = false possible false if(possible){
     System.out.println("Yes");
    }else{
      System.out.println("No");
    } possible {
     System.out.println("Yes");
    } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
      System.out.println("No");
    } System.out.println("No") System.out.println System.out System System.out "No" String[] args args
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int array[] = new int[N];
    for (int i=0;i<N;i++){
      array[i] = sc.nextInt();
    }
    boolean possible = true;
    int nowarray = array[0];
    for (int i=0;i<N;i++){
      if (nowarray+1 <array[i]){
        nowarray = array[i]-1;
    }
      if (nowarray>array[i]){
        possible = false;
      }
    }
    if(possible){
     System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}