import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] height = new int[n];
    for(int i = 0 ; i < n ; i++){
      height[i] = Integer.parseInt(sc.next());
    }

    boolean pos = true;
    for(int i = 0 ; i < n - 1; i++){
     if(height[n - i - 2] - height[n - i - 1] <= 0){
       continue;
     }else if(height[n - i - 2] - height[n - i - 1] == 1){
       height[n - i - 2]--;
     }else{
       pos = false;
       break;
     }
    }
    if(pos){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}

 import java.util.Scanner; Scanner java.util class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] height = new int[n];
    for(int i = 0 ; i < n ; i++){
      height[i] = Integer.parseInt(sc.next());
    }

    boolean pos = true;
    for(int i = 0 ; i < n - 1; i++){
     if(height[n - i - 2] - height[n - i - 1] <= 0){
       continue;
     }else if(height[n - i - 2] - height[n - i - 1] == 1){
       height[n - i - 2]--;
     }else{
       pos = false;
       break;
     }
    }
    if(pos){
      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[] height = new int[n];
    for(int i = 0 ; i < n ; i++){
      height[i] = Integer.parseInt(sc.next());
    }

    boolean pos = true;
    for(int i = 0 ; i < n - 1; i++){
     if(height[n - i - 2] - height[n - i - 1] <= 0){
       continue;
     }else if(height[n - i - 2] - height[n - i - 1] == 1){
       height[n - i - 2]--;
     }else{
       pos = false;
       break;
     }
    }
    if(pos){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] height = new int[n];
    for(int i = 0 ; i < n ; i++){
      height[i] = Integer.parseInt(sc.next());
    }

    boolean pos = true;
    for(int i = 0 ; i < n - 1; i++){
     if(height[n - i - 2] - height[n - i - 1] <= 0){
       continue;
     }else if(height[n - i - 2] - height[n - i - 1] == 1){
       height[n - i - 2]--;
     }else{
       pos = false;
       break;
     }
    }
    if(pos){
      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[] height = new int[n]; height new int[n] n for(int i = 0 ; i < n ; i++){
      height[i] = Integer.parseInt(sc.next());
    } int i = 0 ; int i = 0 ; i 0 i < n i n i++ i++ i {
      height[i] = Integer.parseInt(sc.next());
    } {
      height[i] = Integer.parseInt(sc.next());
    } height[i] = Integer.parseInt(sc.next()) height[i] height i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc boolean pos = true; pos true for(int i = 0 ; i < n - 1; i++){
     if(height[n - i - 2] - height[n - i - 1] <= 0){
       continue;
     }else if(height[n - i - 2] - height[n - i - 1] == 1){
       height[n - i - 2]--;
     }else{
       pos = false;
       break;
     }
    } int i = 0 ; int i = 0 ; i 0 i < n - 1 i n - 1 n 1 i++ i++ i {
     if(height[n - i - 2] - height[n - i - 1] <= 0){
       continue;
     }else if(height[n - i - 2] - height[n - i - 1] == 1){
       height[n - i - 2]--;
     }else{
       pos = false;
       break;
     }
    } {
     if(height[n - i - 2] - height[n - i - 1] <= 0){
       continue;
     }else if(height[n - i - 2] - height[n - i - 1] == 1){
       height[n - i - 2]--;
     }else{
       pos = false;
       break;
     }
    } if(height[n - i - 2] - height[n - i - 1] <= 0){
       continue;
     }else if(height[n - i - 2] - height[n - i - 1] == 1){
       height[n - i - 2]--;
     }else{
       pos = false;
       break;
     } height[n - i - 2] - height[n - i - 1] <= 0 height[n - i - 2] - height[n - i - 1] height[n - i - 2] height n - i - 2 n - i - 2 n i 2 height[n - i - 1] height n - i - 1 n - i - 1 n i 1 0 {
       continue;
     } continue; if(height[n - i - 2] - height[n - i - 1] == 1){
       height[n - i - 2]--;
     }else{
       pos = false;
       break;
     } height[n - i - 2] - height[n - i - 1] == 1 height[n - i - 2] - height[n - i - 1] height[n - i - 2] height n - i - 2 n - i - 2 n i 2 height[n - i - 1] height n - i - 1 n - i - 1 n i 1 1 {
       height[n - i - 2]--;
     } height[n - i - 2]-- height[n - i - 2] height n - i - 2 n - i - 2 n i 2 {
       pos = false;
       break;
     } pos = false pos false break; if(pos){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    } pos {
      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.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] height = new int[n];
    for(int i = 0 ; i < n ; i++){
      height[i] = Integer.parseInt(sc.next());
    }

    boolean pos = true;
    for(int i = 0 ; i < n - 1; i++){
     if(height[n - i - 2] - height[n - i - 1] <= 0){
       continue;
     }else if(height[n - i - 2] - height[n - i - 1] == 1){
       height[n - i - 2]--;
     }else{
       pos = false;
       break;
     }
    }
    if(pos){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}


