import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt(); 

    // long[] h = new long[N];
    long[] h = new long[N];
    for (int i=0; i < N ;i++) {
      h[i] =  sc.nextLong();
    }
    for (int i=N-1;i>0;i--) {
      // System.out.println(i);
      if(h[i-1]>h[i]){
        if(h[i-1] - h[i] ==1){
         h[i-1]--; 
        }else{
          System.out.println("No");
          return;
        }
      }

    }
    System.out.println("Yes");
  }
}
 import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt(); 

    // long[] h = new long[N];
    long[] h = new long[N];
    for (int i=0; i < N ;i++) {
      h[i] =  sc.nextLong();
    }
    for (int i=N-1;i>0;i--) {
      // System.out.println(i);
      if(h[i-1]>h[i]){
        if(h[i-1] - h[i] ==1){
         h[i-1]--; 
        }else{
          System.out.println("No");
          return;
        }
      }

    }
    System.out.println("Yes");
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt(); 

    // long[] h = new long[N];
    long[] h = new long[N];
    for (int i=0; i < N ;i++) {
      h[i] =  sc.nextLong();
    }
    for (int i=N-1;i>0;i--) {
      // System.out.println(i);
      if(h[i-1]>h[i]){
        if(h[i-1] - h[i] ==1){
         h[i-1]--; 
        }else{
          System.out.println("No");
          return;
        }
      }

    }
    System.out.println("Yes");
  } main {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt(); 

    // long[] h = new long[N];
    long[] h = new long[N];
    for (int i=0; i < N ;i++) {
      h[i] =  sc.nextLong();
    }
    for (int i=N-1;i>0;i--) {
      // System.out.println(i);
      if(h[i-1]>h[i]){
        if(h[i-1] - h[i] ==1){
         h[i-1]--; 
        }else{
          System.out.println("No");
          return;
        }
      }

    }
    System.out.println("Yes");
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc long[] h = new long[N]; h new long[N] N for (int i=0; i < N ;i++) {
      h[i] =  sc.nextLong();
    } int i=0; int i=0; i 0 i < N i N i++ i++ i {
      h[i] =  sc.nextLong();
    } {
      h[i] =  sc.nextLong();
    } h[i] =  sc.nextLong() h[i] h i sc.nextLong() sc.nextLong sc for (int i=N-1;i>0;i--) {
      // System.out.println(i);
      if(h[i-1]>h[i]){
        if(h[i-1] - h[i] ==1){
         h[i-1]--; 
        }else{
          System.out.println("No");
          return;
        }
      }

    } int i=N-1; int i=N-1; i N-1 N 1 i>0 i 0 i-- i-- i {
      // System.out.println(i);
      if(h[i-1]>h[i]){
        if(h[i-1] - h[i] ==1){
         h[i-1]--; 
        }else{
          System.out.println("No");
          return;
        }
      }

    } {
      // System.out.println(i);
      if(h[i-1]>h[i]){
        if(h[i-1] - h[i] ==1){
         h[i-1]--; 
        }else{
          System.out.println("No");
          return;
        }
      }

    } if(h[i-1]>h[i]){
        if(h[i-1] - h[i] ==1){
         h[i-1]--; 
        }else{
          System.out.println("No");
          return;
        }
      } h[i-1]>h[i] h[i-1] h i-1 i 1 h[i] h i {
        if(h[i-1] - h[i] ==1){
         h[i-1]--; 
        }else{
          System.out.println("No");
          return;
        }
      } if(h[i-1] - h[i] ==1){
         h[i-1]--; 
        }else{
          System.out.println("No");
          return;
        } h[i-1] - h[i] ==1 h[i-1] - h[i] h[i-1] h i-1 i 1 h[i] h i 1 {
         h[i-1]--; 
        } h[i-1]-- h[i-1] h i-1 i 1 {
          System.out.println("No");
          return;
        } System.out.println("No") System.out.println System.out System System.out "No" return; System.out.println("Yes") System.out.println System.out System System.out "Yes" String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt(); 

    // long[] h = new long[N];
    long[] h = new long[N];
    for (int i=0; i < N ;i++) {
      h[i] =  sc.nextLong();
    }
    for (int i=N-1;i>0;i--) {
      // System.out.println(i);
      if(h[i-1]>h[i]){
        if(h[i-1] - h[i] ==1){
         h[i-1]--; 
        }else{
          System.out.println("No");
          return;
        }
      }

    }
    System.out.println("Yes");
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt(); 

    // long[] h = new long[N];
    long[] h = new long[N];
    for (int i=0; i < N ;i++) {
      h[i] =  sc.nextLong();
    }
    for (int i=N-1;i>0;i--) {
      // System.out.println(i);
      if(h[i-1]>h[i]){
        if(h[i-1] - h[i] ==1){
         h[i-1]--; 
        }else{
          System.out.println("No");
          return;
        }
      }

    }
    System.out.println("Yes");
  }
} Main
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt(); 

    // long[] h = new long[N];
    long[] h = new long[N];
    for (int i=0; i < N ;i++) {
      h[i] =  sc.nextLong();
    }
    for (int i=N-1;i>0;i--) {
      // System.out.println(i);
      if(h[i-1]>h[i]){
        if(h[i-1] - h[i] ==1){
         h[i-1]--; 
        }else{
          System.out.println("No");
          return;
        }
      }

    }
    System.out.println("Yes");
  }
}

