import java.io.*;
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    int[] H = new int[N];
    for (int i = 0; i < N; i++) {
      H[i] = Integer.parseInt(sc.next());
    }

    if (N == 1) {
      System.out.println("Yes");
      return;
    }
    
    if (H[0] > H[1]) {
      H[0]--;
    }
    for (int i = 1; i < N; i++) {
      if (H[i-1] > H[i]) {
        System.out.println("No");
        return;
      }
      if (H[i] > H[i-1]) {
        H[i]--;
      }
    }
    
    if (H[N-1] < H[N-2]) {
      System.out.println("No");
      return;
    }
    
    System.out.println("Yes");
  }
} import java.io.*; io.* java import java.util.*; util.* java class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    int[] H = new int[N];
    for (int i = 0; i < N; i++) {
      H[i] = Integer.parseInt(sc.next());
    }

    if (N == 1) {
      System.out.println("Yes");
      return;
    }
    
    if (H[0] > H[1]) {
      H[0]--;
    }
    for (int i = 1; i < N; i++) {
      if (H[i-1] > H[i]) {
        System.out.println("No");
        return;
      }
      if (H[i] > H[i-1]) {
        H[i]--;
      }
    }
    
    if (H[N-1] < H[N-2]) {
      System.out.println("No");
      return;
    }
    
    System.out.println("Yes");
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    int[] H = new int[N];
    for (int i = 0; i < N; i++) {
      H[i] = Integer.parseInt(sc.next());
    }

    if (N == 1) {
      System.out.println("Yes");
      return;
    }
    
    if (H[0] > H[1]) {
      H[0]--;
    }
    for (int i = 1; i < N; i++) {
      if (H[i-1] > H[i]) {
        System.out.println("No");
        return;
      }
      if (H[i] > H[i-1]) {
        H[i]--;
      }
    }
    
    if (H[N-1] < H[N-2]) {
      System.out.println("No");
      return;
    }
    
    System.out.println("Yes");
  } main {
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    int[] H = new int[N];
    for (int i = 0; i < N; i++) {
      H[i] = Integer.parseInt(sc.next());
    }

    if (N == 1) {
      System.out.println("Yes");
      return;
    }
    
    if (H[0] > H[1]) {
      H[0]--;
    }
    for (int i = 1; i < N; i++) {
      if (H[i-1] > H[i]) {
        System.out.println("No");
        return;
      }
      if (H[i] > H[i-1]) {
        H[i]--;
      }
    }
    
    if (H[N-1] < H[N-2]) {
      System.out.println("No");
      return;
    }
    
    System.out.println("Yes");
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = Integer.parseInt(sc.next()); N Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int[] H = new int[N]; H new int[N] N for (int i = 0; i < N; i++) {
      H[i] = Integer.parseInt(sc.next());
    } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
      H[i] = Integer.parseInt(sc.next());
    } {
      H[i] = Integer.parseInt(sc.next());
    } H[i] = Integer.parseInt(sc.next()) H[i] H i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc if (N == 1) {
      System.out.println("Yes");
      return;
    } N == 1 N 1 {
      System.out.println("Yes");
      return;
    } System.out.println("Yes") System.out.println System.out System System.out "Yes" return; if (H[0] > H[1]) {
      H[0]--;
    } H[0] > H[1] H[0] H 0 H[1] H 1 {
      H[0]--;
    } H[0]-- H[0] H 0 for (int i = 1; i < N; i++) {
      if (H[i-1] > H[i]) {
        System.out.println("No");
        return;
      }
      if (H[i] > H[i-1]) {
        H[i]--;
      }
    } int i = 1; int i = 1; i 1 i < N i N i++ i++ i {
      if (H[i-1] > H[i]) {
        System.out.println("No");
        return;
      }
      if (H[i] > H[i-1]) {
        H[i]--;
      }
    } {
      if (H[i-1] > H[i]) {
        System.out.println("No");
        return;
      }
      if (H[i] > H[i-1]) {
        H[i]--;
      }
    } if (H[i-1] > H[i]) {
        System.out.println("No");
        return;
      } H[i-1] > H[i] H[i-1] H i-1 i 1 H[i] H i {
        System.out.println("No");
        return;
      } System.out.println("No") System.out.println System.out System System.out "No" return; if (H[i] > H[i-1]) {
        H[i]--;
      } H[i] > H[i-1] H[i] H i H[i-1] H i-1 i 1 {
        H[i]--;
      } H[i]-- H[i] H i if (H[N-1] < H[N-2]) {
      System.out.println("No");
      return;
    } H[N-1] < H[N-2] H[N-1] H N-1 N 1 H[N-2] H N-2 N 2 {
      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
import java.io.*;
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    int[] H = new int[N];
    for (int i = 0; i < N; i++) {
      H[i] = Integer.parseInt(sc.next());
    }

    if (N == 1) {
      System.out.println("Yes");
      return;
    }
    
    if (H[0] > H[1]) {
      H[0]--;
    }
    for (int i = 1; i < N; i++) {
      if (H[i-1] > H[i]) {
        System.out.println("No");
        return;
      }
      if (H[i] > H[i-1]) {
        H[i]--;
      }
    }
    
    if (H[N-1] < H[N-2]) {
      System.out.println("No");
      return;
    }
    
    System.out.println("Yes");
  }
}