import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    long[] a = new long[n];
    for (int i=0;i<n;i++){
      a[i] = scan.nextLong();
    }

    int range = 0;
    for(int j=0;j<n-1;j++){
      if (a[j+1] >= a[j] + 1){
        a[j+1] -= 1;
      }
      else{
        if (a[j+1] != a[j]){
          System.out.println("No");
          return;
        }
      }
    }
    System.out.println("Yes");

  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    long[] a = new long[n];
    for (int i=0;i<n;i++){
      a[i] = scan.nextLong();
    }

    int range = 0;
    for(int j=0;j<n-1;j++){
      if (a[j+1] >= a[j] + 1){
        a[j+1] -= 1;
      }
      else{
        if (a[j+1] != a[j]){
          System.out.println("No");
          return;
        }
      }
    }
    System.out.println("Yes");

  }
} Main public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    long[] a = new long[n];
    for (int i=0;i<n;i++){
      a[i] = scan.nextLong();
    }

    int range = 0;
    for(int j=0;j<n-1;j++){
      if (a[j+1] >= a[j] + 1){
        a[j+1] -= 1;
      }
      else{
        if (a[j+1] != a[j]){
          System.out.println("No");
          return;
        }
      }
    }
    System.out.println("Yes");

  } main {
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    long[] a = new long[n];
    for (int i=0;i<n;i++){
      a[i] = scan.nextLong();
    }

    int range = 0;
    for(int j=0;j<n-1;j++){
      if (a[j+1] >= a[j] + 1){
        a[j+1] -= 1;
      }
      else{
        if (a[j+1] != a[j]){
          System.out.println("No");
          return;
        }
      }
    }
    System.out.println("Yes");

  } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan long[] a = new long[n]; a new long[n] n for (int i=0;i<n;i++){
      a[i] = scan.nextLong();
    } int i=0; int i=0; i 0 i<n i n i++ i++ i {
      a[i] = scan.nextLong();
    } {
      a[i] = scan.nextLong();
    } a[i] = scan.nextLong() a[i] a i scan.nextLong() scan.nextLong scan int range = 0; range 0 for(int j=0;j<n-1;j++){
      if (a[j+1] >= a[j] + 1){
        a[j+1] -= 1;
      }
      else{
        if (a[j+1] != a[j]){
          System.out.println("No");
          return;
        }
      }
    } int j=0; int j=0; j 0 j<n-1 j n-1 n 1 j++ j++ j {
      if (a[j+1] >= a[j] + 1){
        a[j+1] -= 1;
      }
      else{
        if (a[j+1] != a[j]){
          System.out.println("No");
          return;
        }
      }
    } {
      if (a[j+1] >= a[j] + 1){
        a[j+1] -= 1;
      }
      else{
        if (a[j+1] != a[j]){
          System.out.println("No");
          return;
        }
      }
    } if (a[j+1] >= a[j] + 1){
        a[j+1] -= 1;
      }
      else{
        if (a[j+1] != a[j]){
          System.out.println("No");
          return;
        }
      } a[j+1] >= a[j] + 1 a[j+1] a j+1 j 1 a[j] + 1 a[j] a j 1 {
        a[j+1] -= 1;
      } a[j+1] -= 1 a[j+1] a j+1 j 1 1 {
        if (a[j+1] != a[j]){
          System.out.println("No");
          return;
        }
      } if (a[j+1] != a[j]){
          System.out.println("No");
          return;
        } a[j+1] != a[j] a[j+1] a j+1 j 1 a[j] a j {
          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 scan = new Scanner(System.in);
    int n = scan.nextInt();
    long[] a = new long[n];
    for (int i=0;i<n;i++){
      a[i] = scan.nextLong();
    }

    int range = 0;
    for(int j=0;j<n-1;j++){
      if (a[j+1] >= a[j] + 1){
        a[j+1] -= 1;
      }
      else{
        if (a[j+1] != a[j]){
          System.out.println("No");
          return;
        }
      }
    }
    System.out.println("Yes");

  }
} public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    long[] a = new long[n];
    for (int i=0;i<n;i++){
      a[i] = scan.nextLong();
    }

    int range = 0;
    for(int j=0;j<n-1;j++){
      if (a[j+1] >= a[j] + 1){
        a[j+1] -= 1;
      }
      else{
        if (a[j+1] != a[j]){
          System.out.println("No");
          return;
        }
      }
    }
    System.out.println("Yes");

  }
} Main
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    long[] a = new long[n];
    for (int i=0;i<n;i++){
      a[i] = scan.nextLong();
    }

    int range = 0;
    for(int j=0;j<n-1;j++){
      if (a[j+1] >= a[j] + 1){
        a[j+1] -= 1;
      }
      else{
        if (a[j+1] != a[j]){
          System.out.println("No");
          return;
        }
      }
    }
    System.out.println("Yes");

  }
}
