import java.util.*;
public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int a[] = new int[n];
    a[0] = sc.nextInt();
    int max = a[0];
    String s = "Yes";
    for(int i = 1;i<n;i++){
      a[i] = sc.nextInt();
      if(a[i]>max){
        max = a[i];
      }
      if(max-1>a[i]){
        s = "No";
        break;
      }
    }
    System.out.println(s);    
  } 
} import java.util.*; util.* java public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int a[] = new int[n];
    a[0] = sc.nextInt();
    int max = a[0];
    String s = "Yes";
    for(int i = 1;i<n;i++){
      a[i] = sc.nextInt();
      if(a[i]>max){
        max = a[i];
      }
      if(max-1>a[i]){
        s = "No";
        break;
      }
    }
    System.out.println(s);    
  } 
} Main public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int a[] = new int[n];
    a[0] = sc.nextInt();
    int max = a[0];
    String s = "Yes";
    for(int i = 1;i<n;i++){
      a[i] = sc.nextInt();
      if(a[i]>max){
        max = a[i];
      }
      if(max-1>a[i]){
        s = "No";
        break;
      }
    }
    System.out.println(s);    
  } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int a[] = new int[n];
    a[0] = sc.nextInt();
    int max = a[0];
    String s = "Yes";
    for(int i = 1;i<n;i++){
      a[i] = sc.nextInt();
      if(a[i]>max){
        max = a[i];
      }
      if(max-1>a[i]){
        s = "No";
        break;
      }
    }
    System.out.println(s);    
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int a[] = new int[n]; a new int[n] n a[0] = sc.nextInt() a[0] a 0 sc.nextInt() sc.nextInt sc int max = a[0]; max a[0] a 0 String s = "Yes"; s "Yes" for(int i = 1;i<n;i++){
      a[i] = sc.nextInt();
      if(a[i]>max){
        max = a[i];
      }
      if(max-1>a[i]){
        s = "No";
        break;
      }
    } int i = 1; int i = 1; i 1 i<n i n i++ i++ i {
      a[i] = sc.nextInt();
      if(a[i]>max){
        max = a[i];
      }
      if(max-1>a[i]){
        s = "No";
        break;
      }
    } {
      a[i] = sc.nextInt();
      if(a[i]>max){
        max = a[i];
      }
      if(max-1>a[i]){
        s = "No";
        break;
      }
    } a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc if(a[i]>max){
        max = a[i];
      } a[i]>max a[i] a i max {
        max = a[i];
      } max = a[i] max a[i] a i if(max-1>a[i]){
        s = "No";
        break;
      } max-1>a[i] max-1 max 1 a[i] a i {
        s = "No";
        break;
      } s = "No" s "No" break; System.out.println(s) System.out.println System.out System System.out s String args[] args public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int a[] = new int[n];
    a[0] = sc.nextInt();
    int max = a[0];
    String s = "Yes";
    for(int i = 1;i<n;i++){
      a[i] = sc.nextInt();
      if(a[i]>max){
        max = a[i];
      }
      if(max-1>a[i]){
        s = "No";
        break;
      }
    }
    System.out.println(s);    
  } 
} public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int a[] = new int[n];
    a[0] = sc.nextInt();
    int max = a[0];
    String s = "Yes";
    for(int i = 1;i<n;i++){
      a[i] = sc.nextInt();
      if(a[i]>max){
        max = a[i];
      }
      if(max-1>a[i]){
        s = "No";
        break;
      }
    }
    System.out.println(s);    
  } 
} Main
import java.util.*;
public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int a[] = new int[n];
    a[0] = sc.nextInt();
    int max = a[0];
    String s = "Yes";
    for(int i = 1;i<n;i++){
      a[i] = sc.nextInt();
      if(a[i]>max){
        max = a[i];
      }
      if(max-1>a[i]){
        s = "No";
        break;
      }
    }
    System.out.println(s);    
  } 
}