import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int[]H = new int[N];

		for (int i=0; i<N; i++){
			H[i] = sc.nextInt();
		}

		for (int i=1; i<N; i++){
			if (i == 1){
				H[0]--;
			} else {
				if (H[i-1] -1 >= H[i-2]){
					H[i-1]--;
				}
			}
		}
		int[] H1 = H.clone();
		Arrays.sort(H);
		if (Arrays.equals(H, H1)){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int[]H = new int[N];

		for (int i=0; i<N; i++){
			H[i] = sc.nextInt();
		}

		for (int i=1; i<N; i++){
			if (i == 1){
				H[0]--;
			} else {
				if (H[i-1] -1 >= H[i-2]){
					H[i-1]--;
				}
			}
		}
		int[] H1 = H.clone();
		Arrays.sort(H);
		if (Arrays.equals(H, H1)){
			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[]H = new int[N];

		for (int i=0; i<N; i++){
			H[i] = sc.nextInt();
		}

		for (int i=1; i<N; i++){
			if (i == 1){
				H[0]--;
			} else {
				if (H[i-1] -1 >= H[i-2]){
					H[i-1]--;
				}
			}
		}
		int[] H1 = H.clone();
		Arrays.sort(H);
		if (Arrays.equals(H, H1)){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	} main {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int[]H = new int[N];

		for (int i=0; i<N; i++){
			H[i] = sc.nextInt();
		}

		for (int i=1; i<N; i++){
			if (i == 1){
				H[0]--;
			} else {
				if (H[i-1] -1 >= H[i-2]){
					H[i-1]--;
				}
			}
		}
		int[] H1 = H.clone();
		Arrays.sort(H);
		if (Arrays.equals(H, H1)){
			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[]H = new int[N]; H new int[N] N for (int i=0; i<N; i++){
			H[i] = sc.nextInt();
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			H[i] = sc.nextInt();
		} {
			H[i] = sc.nextInt();
		} H[i] = sc.nextInt() H[i] H i sc.nextInt() sc.nextInt sc for (int i=1; i<N; i++){
			if (i == 1){
				H[0]--;
			} else {
				if (H[i-1] -1 >= H[i-2]){
					H[i-1]--;
				}
			}
		} int i=1; int i=1; i 1 i<N i N i++ i++ i {
			if (i == 1){
				H[0]--;
			} else {
				if (H[i-1] -1 >= H[i-2]){
					H[i-1]--;
				}
			}
		} {
			if (i == 1){
				H[0]--;
			} else {
				if (H[i-1] -1 >= H[i-2]){
					H[i-1]--;
				}
			}
		} if (i == 1){
				H[0]--;
			} else {
				if (H[i-1] -1 >= H[i-2]){
					H[i-1]--;
				}
			} i == 1 i 1 {
				H[0]--;
			} H[0]-- H[0] H 0 {
				if (H[i-1] -1 >= H[i-2]){
					H[i-1]--;
				}
			} if (H[i-1] -1 >= H[i-2]){
					H[i-1]--;
				} H[i-1] -1 >= H[i-2] H[i-1] -1 H[i-1] H i-1 i 1 1 H[i-2] H i-2 i 2 {
					H[i-1]--;
				} H[i-1]-- H[i-1] H i-1 i 1 int[] H1 = H.clone(); H1 H.clone() H.clone H Arrays.sort(H) Arrays.sort Arrays H if (Arrays.equals(H, H1)){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		} Arrays.equals(H, H1) Arrays.equals Arrays H H1 {
			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 public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int[]H = new int[N];

		for (int i=0; i<N; i++){
			H[i] = sc.nextInt();
		}

		for (int i=1; i<N; i++){
			if (i == 1){
				H[0]--;
			} else {
				if (H[i-1] -1 >= H[i-2]){
					H[i-1]--;
				}
			}
		}
		int[] H1 = H.clone();
		Arrays.sort(H);
		if (Arrays.equals(H, H1)){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int[]H = new int[N];

		for (int i=0; i<N; i++){
			H[i] = sc.nextInt();
		}

		for (int i=1; i<N; i++){
			if (i == 1){
				H[0]--;
			} else {
				if (H[i-1] -1 >= H[i-2]){
					H[i-1]--;
				}
			}
		}
		int[] H1 = H.clone();
		Arrays.sort(H);
		if (Arrays.equals(H, H1)){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int[]H = new int[N];

		for (int i=0; i<N; i++){
			H[i] = sc.nextInt();
		}

		for (int i=1; i<N; i++){
			if (i == 1){
				H[0]--;
			} else {
				if (H[i-1] -1 >= H[i-2]){
					H[i-1]--;
				}
			}
		}
		int[] H1 = H.clone();
		Arrays.sort(H);
		if (Arrays.equals(H, H1)){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}