import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    int n = input.nextInt();
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = input.nextInt();
    }

    if (n == 1) {
      System.out.println("Yes");
      return;
    }

    else {
      for (int i = 1; i < n; i++) {

        if (array[i] < array[i - 1]) {
          System.out.println("No");
          return;

        } else if (array[i] > array[i - 1]) {
          array[i] = array[i] - 1;
        }
      }
    }
    System.out.println("Yes");
  }



}

 import java.util.*; util.* java public class Main {

  public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    int n = input.nextInt();
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = input.nextInt();
    }

    if (n == 1) {
      System.out.println("Yes");
      return;
    }

    else {
      for (int i = 1; i < n; i++) {

        if (array[i] < array[i - 1]) {
          System.out.println("No");
          return;

        } else if (array[i] > array[i - 1]) {
          array[i] = array[i] - 1;
        }
      }
    }
    System.out.println("Yes");
  }



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

    if (n == 1) {
      System.out.println("Yes");
      return;
    }

    else {
      for (int i = 1; i < n; i++) {

        if (array[i] < array[i - 1]) {
          System.out.println("No");
          return;

        } else if (array[i] > array[i - 1]) {
          array[i] = array[i] - 1;
        }
      }
    }
    System.out.println("Yes");
  } main {
    Scanner input = new Scanner(System.in);
    int n = input.nextInt();
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = input.nextInt();
    }

    if (n == 1) {
      System.out.println("Yes");
      return;
    }

    else {
      for (int i = 1; i < n; i++) {

        if (array[i] < array[i - 1]) {
          System.out.println("No");
          return;

        } else if (array[i] > array[i - 1]) {
          array[i] = array[i] - 1;
        }
      }
    }
    System.out.println("Yes");
  } Scanner input = new Scanner(System.in); input new Scanner(System.in) int n = input.nextInt(); n input.nextInt() input.nextInt input int[] array = new int[n]; array new int[n] n for (int i = 0; i < n; i++) {
      array[i] = input.nextInt();
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
      array[i] = input.nextInt();
    } {
      array[i] = input.nextInt();
    } array[i] = input.nextInt() array[i] array i input.nextInt() input.nextInt input if (n == 1) {
      System.out.println("Yes");
      return;
    }

    else {
      for (int i = 1; i < n; i++) {

        if (array[i] < array[i - 1]) {
          System.out.println("No");
          return;

        } else if (array[i] > array[i - 1]) {
          array[i] = array[i] - 1;
        }
      }
    } n == 1 n 1 {
      System.out.println("Yes");
      return;
    } System.out.println("Yes") System.out.println System.out System System.out "Yes" return; {
      for (int i = 1; i < n; i++) {

        if (array[i] < array[i - 1]) {
          System.out.println("No");
          return;

        } else if (array[i] > array[i - 1]) {
          array[i] = array[i] - 1;
        }
      }
    } for (int i = 1; i < n; i++) {

        if (array[i] < array[i - 1]) {
          System.out.println("No");
          return;

        } else if (array[i] > array[i - 1]) {
          array[i] = array[i] - 1;
        }
      } int i = 1; int i = 1; i 1 i < n i n i++ i++ i {

        if (array[i] < array[i - 1]) {
          System.out.println("No");
          return;

        } else if (array[i] > array[i - 1]) {
          array[i] = array[i] - 1;
        }
      } {

        if (array[i] < array[i - 1]) {
          System.out.println("No");
          return;

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

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

        } System.out.println("No") System.out.println System.out System System.out "No" return; if (array[i] > array[i - 1]) {
          array[i] = array[i] - 1;
        } array[i] > array[i - 1] array[i] array i array[i - 1] array i - 1 i 1 {
          array[i] = array[i] - 1;
        } array[i] = array[i] - 1 array[i] array i array[i] - 1 array[i] array i 1 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 input = new Scanner(System.in);
    int n = input.nextInt();
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = input.nextInt();
    }

    if (n == 1) {
      System.out.println("Yes");
      return;
    }

    else {
      for (int i = 1; i < n; i++) {

        if (array[i] < array[i - 1]) {
          System.out.println("No");
          return;

        } else if (array[i] > array[i - 1]) {
          array[i] = array[i] - 1;
        }
      }
    }
    System.out.println("Yes");
  }



} public class Main {

  public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    int n = input.nextInt();
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = input.nextInt();
    }

    if (n == 1) {
      System.out.println("Yes");
      return;
    }

    else {
      for (int i = 1; i < n; i++) {

        if (array[i] < array[i - 1]) {
          System.out.println("No");
          return;

        } else if (array[i] > array[i - 1]) {
          array[i] = array[i] - 1;
        }
      }
    }
    System.out.println("Yes");
  }



} Main
import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    int n = input.nextInt();
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = input.nextInt();
    }

    if (n == 1) {
      System.out.println("Yes");
      return;
    }

    else {
      for (int i = 1; i < n; i++) {

        if (array[i] < array[i - 1]) {
          System.out.println("No");
          return;

        } else if (array[i] > array[i - 1]) {
          array[i] = array[i] - 1;
        }
      }
    }
    System.out.println("Yes");
  }



}


