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 < h.length; i++) {
			h[i] = sc.nextInt();
		}
		String ans = "Yes";

		for (int i = n - 1; i > 0; i--) {
			if (n == 1) {
				break;
			}
			else if (h[i] - h[i-1] > -1) {
				continue;

			} else if (h[i] - h[i-1] == -1 ) {
				h[i-1]--;
				continue;

			} else {
				ans = "No";
				break;
			}
		}

		System.out.println(ans);
		sc.close();
	}
} 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 < h.length; i++) {
			h[i] = sc.nextInt();
		}
		String ans = "Yes";

		for (int i = n - 1; i > 0; i--) {
			if (n == 1) {
				break;
			}
			else if (h[i] - h[i-1] > -1) {
				continue;

			} else if (h[i] - h[i-1] == -1 ) {
				h[i-1]--;
				continue;

			} else {
				ans = "No";
				break;
			}
		}

		System.out.println(ans);
		sc.close();
	}
} 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 < h.length; i++) {
			h[i] = sc.nextInt();
		}
		String ans = "Yes";

		for (int i = n - 1; i > 0; i--) {
			if (n == 1) {
				break;
			}
			else if (h[i] - h[i-1] > -1) {
				continue;

			} else if (h[i] - h[i-1] == -1 ) {
				h[i-1]--;
				continue;

			} else {
				ans = "No";
				break;
			}
		}

		System.out.println(ans);
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] h = new int[n];
		for (int i = 0; i < h.length; i++) {
			h[i] = sc.nextInt();
		}
		String ans = "Yes";

		for (int i = n - 1; i > 0; i--) {
			if (n == 1) {
				break;
			}
			else if (h[i] - h[i-1] > -1) {
				continue;

			} else if (h[i] - h[i-1] == -1 ) {
				h[i-1]--;
				continue;

			} else {
				ans = "No";
				break;
			}
		}

		System.out.println(ans);
		sc.close();
	} 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 < h.length; i++) {
			h[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < h.length i h.length h h.length 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 ans = "Yes"; ans "Yes" for (int i = n - 1; i > 0; i--) {
			if (n == 1) {
				break;
			}
			else if (h[i] - h[i-1] > -1) {
				continue;

			} else if (h[i] - h[i-1] == -1 ) {
				h[i-1]--;
				continue;

			} else {
				ans = "No";
				break;
			}
		} int i = n - 1; int i = n - 1; i n - 1 n 1 i > 0 i 0 i-- i-- i {
			if (n == 1) {
				break;
			}
			else if (h[i] - h[i-1] > -1) {
				continue;

			} else if (h[i] - h[i-1] == -1 ) {
				h[i-1]--;
				continue;

			} else {
				ans = "No";
				break;
			}
		} {
			if (n == 1) {
				break;
			}
			else if (h[i] - h[i-1] > -1) {
				continue;

			} else if (h[i] - h[i-1] == -1 ) {
				h[i-1]--;
				continue;

			} else {
				ans = "No";
				break;
			}
		} if (n == 1) {
				break;
			}
			else if (h[i] - h[i-1] > -1) {
				continue;

			} else if (h[i] - h[i-1] == -1 ) {
				h[i-1]--;
				continue;

			} else {
				ans = "No";
				break;
			} n == 1 n 1 {
				break;
			} break; if (h[i] - h[i-1] > -1) {
				continue;

			} else if (h[i] - h[i-1] == -1 ) {
				h[i-1]--;
				continue;

			} else {
				ans = "No";
				break;
			} h[i] - h[i-1] > -1 h[i] - h[i-1] h[i] h i h[i-1] h i-1 i 1 -1 1 {
				continue;

			} continue; if (h[i] - h[i-1] == -1 ) {
				h[i-1]--;
				continue;

			} else {
				ans = "No";
				break;
			} h[i] - h[i-1] == -1 h[i] - h[i-1] h[i] h i h[i-1] h i-1 i 1 -1 1 {
				h[i-1]--;
				continue;

			} h[i-1]-- h[i-1] h i-1 i 1 continue; {
				ans = "No";
				break;
			} ans = "No" ans "No" break; System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc 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 < h.length; i++) {
			h[i] = sc.nextInt();
		}
		String ans = "Yes";

		for (int i = n - 1; i > 0; i--) {
			if (n == 1) {
				break;
			}
			else if (h[i] - h[i-1] > -1) {
				continue;

			} else if (h[i] - h[i-1] == -1 ) {
				h[i-1]--;
				continue;

			} else {
				ans = "No";
				break;
			}
		}

		System.out.println(ans);
		sc.close();
	}
} 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 < h.length; i++) {
			h[i] = sc.nextInt();
		}
		String ans = "Yes";

		for (int i = n - 1; i > 0; i--) {
			if (n == 1) {
				break;
			}
			else if (h[i] - h[i-1] > -1) {
				continue;

			} else if (h[i] - h[i-1] == -1 ) {
				h[i-1]--;
				continue;

			} else {
				ans = "No";
				break;
			}
		}

		System.out.println(ans);
		sc.close();
	}
} 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 < h.length; i++) {
			h[i] = sc.nextInt();
		}
		String ans = "Yes";

		for (int i = n - 1; i > 0; i--) {
			if (n == 1) {
				break;
			}
			else if (h[i] - h[i-1] > -1) {
				continue;

			} else if (h[i] - h[i-1] == -1 ) {
				h[i-1]--;
				continue;

			} else {
				ans = "No";
				break;
			}
		}

		System.out.println(ans);
		sc.close();
	}
}