

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();
		}

		String answer = "Yes";

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

			boolean flg = false;
			if (h[i] - h[i + 1] >= 2) {
				answer = "No";
				break;
			}

			if (i > 0) {
				if (h[i - 1] == h[i]) {
					flg = true;
				}
			}

			if (flg && h[i] > h[i + 1]) {
				answer = "No";
				break;
			}

			if (!flg)
				h[i]--;
		}
		System.out.println(answer);
	}

} 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();
		}

		String answer = "Yes";

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

			boolean flg = false;
			if (h[i] - h[i + 1] >= 2) {
				answer = "No";
				break;
			}

			if (i > 0) {
				if (h[i - 1] == h[i]) {
					flg = true;
				}
			}

			if (flg && h[i] > h[i + 1]) {
				answer = "No";
				break;
			}

			if (!flg)
				h[i]--;
		}
		System.out.println(answer);
	}

} 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();
		}

		String answer = "Yes";

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

			boolean flg = false;
			if (h[i] - h[i + 1] >= 2) {
				answer = "No";
				break;
			}

			if (i > 0) {
				if (h[i - 1] == h[i]) {
					flg = true;
				}
			}

			if (flg && h[i] > h[i + 1]) {
				answer = "No";
				break;
			}

			if (!flg)
				h[i]--;
		}
		System.out.println(answer);
	} 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();
		}

		String answer = "Yes";

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

			boolean flg = false;
			if (h[i] - h[i + 1] >= 2) {
				answer = "No";
				break;
			}

			if (i > 0) {
				if (h[i - 1] == h[i]) {
					flg = true;
				}
			}

			if (flg && h[i] > h[i + 1]) {
				answer = "No";
				break;
			}

			if (!flg)
				h[i]--;
		}
		System.out.println(answer);
	} 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 String answer = "Yes"; answer "Yes" for (int i = 0; i < n - 1; i++) {

			boolean flg = false;
			if (h[i] - h[i + 1] >= 2) {
				answer = "No";
				break;
			}

			if (i > 0) {
				if (h[i - 1] == h[i]) {
					flg = true;
				}
			}

			if (flg && h[i] > h[i + 1]) {
				answer = "No";
				break;
			}

			if (!flg)
				h[i]--;
		} int i = 0; int i = 0; i 0 i < n - 1 i n - 1 n 1 i++ i++ i {

			boolean flg = false;
			if (h[i] - h[i + 1] >= 2) {
				answer = "No";
				break;
			}

			if (i > 0) {
				if (h[i - 1] == h[i]) {
					flg = true;
				}
			}

			if (flg && h[i] > h[i + 1]) {
				answer = "No";
				break;
			}

			if (!flg)
				h[i]--;
		} {

			boolean flg = false;
			if (h[i] - h[i + 1] >= 2) {
				answer = "No";
				break;
			}

			if (i > 0) {
				if (h[i - 1] == h[i]) {
					flg = true;
				}
			}

			if (flg && h[i] > h[i + 1]) {
				answer = "No";
				break;
			}

			if (!flg)
				h[i]--;
		} boolean flg = false; flg false if (h[i] - h[i + 1] >= 2) {
				answer = "No";
				break;
			} h[i] - h[i + 1] >= 2 h[i] - h[i + 1] h[i] h i h[i + 1] h i + 1 i 1 2 {
				answer = "No";
				break;
			} answer = "No" answer "No" break; if (i > 0) {
				if (h[i - 1] == h[i]) {
					flg = true;
				}
			} i > 0 i 0 {
				if (h[i - 1] == h[i]) {
					flg = true;
				}
			} if (h[i - 1] == h[i]) {
					flg = true;
				} h[i - 1] == h[i] h[i - 1] h i - 1 i 1 h[i] h i {
					flg = true;
				} flg = true flg true if (flg && h[i] > h[i + 1]) {
				answer = "No";
				break;
			} flg && h[i] > h[i + 1] flg h[i] > h[i + 1] h[i] h i h[i + 1] h i + 1 i 1 {
				answer = "No";
				break;
			} answer = "No" answer "No" break; if (!flg)
				h[i]--; !flg flg h[i]-- h[i] h i System.out.println(answer) System.out.println System.out System System.out answer 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();
		}

		String answer = "Yes";

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

			boolean flg = false;
			if (h[i] - h[i + 1] >= 2) {
				answer = "No";
				break;
			}

			if (i > 0) {
				if (h[i - 1] == h[i]) {
					flg = true;
				}
			}

			if (flg && h[i] > h[i + 1]) {
				answer = "No";
				break;
			}

			if (!flg)
				h[i]--;
		}
		System.out.println(answer);
	}

} 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();
		}

		String answer = "Yes";

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

			boolean flg = false;
			if (h[i] - h[i + 1] >= 2) {
				answer = "No";
				break;
			}

			if (i > 0) {
				if (h[i - 1] == h[i]) {
					flg = true;
				}
			}

			if (flg && h[i] > h[i + 1]) {
				answer = "No";
				break;
			}

			if (!flg)
				h[i]--;
		}
		System.out.println(answer);
	}

} Main


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();
		}

		String answer = "Yes";

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

			boolean flg = false;
			if (h[i] - h[i + 1] >= 2) {
				answer = "No";
				break;
			}

			if (i > 0) {
				if (h[i - 1] == h[i]) {
					flg = true;
				}
			}

			if (flg && h[i] > h[i + 1]) {
				answer = "No";
				break;
			}

			if (!flg)
				h[i]--;
		}
		System.out.println(answer);
	}

}
