import java.util.*;

public class Main{
  public static void main(String args[]){
    //入力
    Scanner scanner = new Scanner(System.in);
    
    int N = scanner.nextInt();
    
    int[] arrayH = new int[N];
    for(int i = 0; i < N; i++){
      arrayH[i] = scanner.nextInt();
    }
    
    //処理
    String result = "Yes";
    int max = 0;
    
    for(int i = 0; i < N; i++){
      if(max - arrayH[i] >= 2){
        result = "No";
      }
      
      if(arrayH[i] > max){
        max = arrayH[i];
      }
    }
    
    System.out.println(result);
  }
} import java.util.*; util.* java public class Main{
  public static void main(String args[]){
    //入力
    Scanner scanner = new Scanner(System.in);
    
    int N = scanner.nextInt();
    
    int[] arrayH = new int[N];
    for(int i = 0; i < N; i++){
      arrayH[i] = scanner.nextInt();
    }
    
    //処理
    String result = "Yes";
    int max = 0;
    
    for(int i = 0; i < N; i++){
      if(max - arrayH[i] >= 2){
        result = "No";
      }
      
      if(arrayH[i] > max){
        max = arrayH[i];
      }
    }
    
    System.out.println(result);
  }
} Main public static void main(String args[]){
    //入力
    Scanner scanner = new Scanner(System.in);
    
    int N = scanner.nextInt();
    
    int[] arrayH = new int[N];
    for(int i = 0; i < N; i++){
      arrayH[i] = scanner.nextInt();
    }
    
    //処理
    String result = "Yes";
    int max = 0;
    
    for(int i = 0; i < N; i++){
      if(max - arrayH[i] >= 2){
        result = "No";
      }
      
      if(arrayH[i] > max){
        max = arrayH[i];
      }
    }
    
    System.out.println(result);
  } main {
    //入力
    Scanner scanner = new Scanner(System.in);
    
    int N = scanner.nextInt();
    
    int[] arrayH = new int[N];
    for(int i = 0; i < N; i++){
      arrayH[i] = scanner.nextInt();
    }
    
    //処理
    String result = "Yes";
    int max = 0;
    
    for(int i = 0; i < N; i++){
      if(max - arrayH[i] >= 2){
        result = "No";
      }
      
      if(arrayH[i] > max){
        max = arrayH[i];
      }
    }
    
    System.out.println(result);
  } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner int[] arrayH = new int[N]; arrayH new int[N] N for(int i = 0; i < N; i++){
      arrayH[i] = scanner.nextInt();
    } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
      arrayH[i] = scanner.nextInt();
    } {
      arrayH[i] = scanner.nextInt();
    } arrayH[i] = scanner.nextInt() arrayH[i] arrayH i scanner.nextInt() scanner.nextInt scanner String result = "Yes"; result "Yes" int max = 0; max 0 for(int i = 0; i < N; i++){
      if(max - arrayH[i] >= 2){
        result = "No";
      }
      
      if(arrayH[i] > max){
        max = arrayH[i];
      }
    } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
      if(max - arrayH[i] >= 2){
        result = "No";
      }
      
      if(arrayH[i] > max){
        max = arrayH[i];
      }
    } {
      if(max - arrayH[i] >= 2){
        result = "No";
      }
      
      if(arrayH[i] > max){
        max = arrayH[i];
      }
    } if(max - arrayH[i] >= 2){
        result = "No";
      } max - arrayH[i] >= 2 max - arrayH[i] max arrayH[i] arrayH i 2 {
        result = "No";
      } result = "No" result "No" if(arrayH[i] > max){
        max = arrayH[i];
      } arrayH[i] > max arrayH[i] arrayH i max {
        max = arrayH[i];
      } max = arrayH[i] max arrayH[i] arrayH i System.out.println(result) System.out.println System.out System System.out result String args[] args public class Main{
  public static void main(String args[]){
    //入力
    Scanner scanner = new Scanner(System.in);
    
    int N = scanner.nextInt();
    
    int[] arrayH = new int[N];
    for(int i = 0; i < N; i++){
      arrayH[i] = scanner.nextInt();
    }
    
    //処理
    String result = "Yes";
    int max = 0;
    
    for(int i = 0; i < N; i++){
      if(max - arrayH[i] >= 2){
        result = "No";
      }
      
      if(arrayH[i] > max){
        max = arrayH[i];
      }
    }
    
    System.out.println(result);
  }
} public class Main{
  public static void main(String args[]){
    //入力
    Scanner scanner = new Scanner(System.in);
    
    int N = scanner.nextInt();
    
    int[] arrayH = new int[N];
    for(int i = 0; i < N; i++){
      arrayH[i] = scanner.nextInt();
    }
    
    //処理
    String result = "Yes";
    int max = 0;
    
    for(int i = 0; i < N; i++){
      if(max - arrayH[i] >= 2){
        result = "No";
      }
      
      if(arrayH[i] > max){
        max = arrayH[i];
      }
    }
    
    System.out.println(result);
  }
} Main
import java.util.*;

public class Main{
  public static void main(String args[]){
    //入力
    Scanner scanner = new Scanner(System.in);
    
    int N = scanner.nextInt();
    
    int[] arrayH = new int[N];
    for(int i = 0; i < N; i++){
      arrayH[i] = scanner.nextInt();
    }
    
    //処理
    String result = "Yes";
    int max = 0;
    
    for(int i = 0; i < N; i++){
      if(max - arrayH[i] >= 2){
        result = "No";
      }
      
      if(arrayH[i] > max){
        max = arrayH[i];
      }
    }
    
    System.out.println(result);
  }
}
