import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int n = scanner.nextInt();
    int[] h = new int[n];
    for(int i = 0; i < n; i++){
      h[i] = scanner.nextInt();
    }
    
    boolean result = true;
    
    for(int i = n - 1; i > 0; i--){
      if(h[i-1] > h[i] + 1){
        result = false;
      }else if(h[i-1] > h[i]){
        h[i-1]--;
      }
    }

    System.out.println(result ? "Yes" : "No");
  }
} import java.util.Scanner; Scanner java.util public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int n = scanner.nextInt();
    int[] h = new int[n];
    for(int i = 0; i < n; i++){
      h[i] = scanner.nextInt();
    }
    
    boolean result = true;
    
    for(int i = n - 1; i > 0; i--){
      if(h[i-1] > h[i] + 1){
        result = false;
      }else if(h[i-1] > h[i]){
        h[i-1]--;
      }
    }

    System.out.println(result ? "Yes" : "No");
  }
} Main public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int n = scanner.nextInt();
    int[] h = new int[n];
    for(int i = 0; i < n; i++){
      h[i] = scanner.nextInt();
    }
    
    boolean result = true;
    
    for(int i = n - 1; i > 0; i--){
      if(h[i-1] > h[i] + 1){
        result = false;
      }else if(h[i-1] > h[i]){
        h[i-1]--;
      }
    }

    System.out.println(result ? "Yes" : "No");
  } main {
    Scanner scanner = new Scanner(System.in);
    int n = scanner.nextInt();
    int[] h = new int[n];
    for(int i = 0; i < n; i++){
      h[i] = scanner.nextInt();
    }
    
    boolean result = true;
    
    for(int i = n - 1; i > 0; i--){
      if(h[i-1] > h[i] + 1){
        result = false;
      }else if(h[i-1] > h[i]){
        h[i-1]--;
      }
    }

    System.out.println(result ? "Yes" : "No");
  } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int[] h = new int[n]; h new int[n] n for(int i = 0; i < n; i++){
      h[i] = scanner.nextInt();
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
      h[i] = scanner.nextInt();
    } {
      h[i] = scanner.nextInt();
    } h[i] = scanner.nextInt() h[i] h i scanner.nextInt() scanner.nextInt scanner boolean result = true; result true for(int i = n - 1; i > 0; i--){
      if(h[i-1] > h[i] + 1){
        result = false;
      }else if(h[i-1] > h[i]){
        h[i-1]--;
      }
    } int i = n - 1; int i = n - 1; i n - 1 n 1 i > 0 i 0 i-- i-- i {
      if(h[i-1] > h[i] + 1){
        result = false;
      }else if(h[i-1] > h[i]){
        h[i-1]--;
      }
    } {
      if(h[i-1] > h[i] + 1){
        result = false;
      }else if(h[i-1] > h[i]){
        h[i-1]--;
      }
    } if(h[i-1] > h[i] + 1){
        result = false;
      }else if(h[i-1] > h[i]){
        h[i-1]--;
      } h[i-1] > h[i] + 1 h[i-1] h i-1 i 1 h[i] + 1 h[i] h i 1 {
        result = false;
      } result = false result false if(h[i-1] > h[i]){
        h[i-1]--;
      } h[i-1] > h[i] h[i-1] h i-1 i 1 h[i] h i {
        h[i-1]--;
      } h[i-1]-- h[i-1] h i-1 i 1 System.out.println(result ? "Yes" : "No") System.out.println System.out System System.out result ? "Yes" : "No" result "Yes" "No" String[] args args public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int n = scanner.nextInt();
    int[] h = new int[n];
    for(int i = 0; i < n; i++){
      h[i] = scanner.nextInt();
    }
    
    boolean result = true;
    
    for(int i = n - 1; i > 0; i--){
      if(h[i-1] > h[i] + 1){
        result = false;
      }else if(h[i-1] > h[i]){
        h[i-1]--;
      }
    }

    System.out.println(result ? "Yes" : "No");
  }
} public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int n = scanner.nextInt();
    int[] h = new int[n];
    for(int i = 0; i < n; i++){
      h[i] = scanner.nextInt();
    }
    
    boolean result = true;
    
    for(int i = n - 1; i > 0; i--){
      if(h[i-1] > h[i] + 1){
        result = false;
      }else if(h[i-1] > h[i]){
        h[i-1]--;
      }
    }

    System.out.println(result ? "Yes" : "No");
  }
} Main
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int n = scanner.nextInt();
    int[] h = new int[n];
    for(int i = 0; i < n; i++){
      h[i] = scanner.nextInt();
    }
    
    boolean result = true;
    
    for(int i = n - 1; i > 0; i--){
      if(h[i-1] > h[i] + 1){
        result = false;
      }else if(h[i-1] > h[i]){
        h[i-1]--;
      }
    }

    System.out.println(result ? "Yes" : "No");
  }
}
