
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] nums = new int[N];

		for (int i = 0; i < N; i++) {
			nums[i] = sc.nextInt();
		}
		if (nums.length == 1) {
			System.out.println("Yes");
		}else {
			int lim = nums[0];
			for (int i = 1; i < N; i++) {
				if (nums[i] < lim) {
					System.out.println("No");
					break;
				}
				if (nums[i-1] - nums[i] < -1) {
					lim = nums[i]-1;

				}
				if (i == N-1) {
					System.out.println("Yes");
					break;
				}

			}
		}
	}
}

 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[] nums = new int[N];

		for (int i = 0; i < N; i++) {
			nums[i] = sc.nextInt();
		}
		if (nums.length == 1) {
			System.out.println("Yes");
		}else {
			int lim = nums[0];
			for (int i = 1; i < N; i++) {
				if (nums[i] < lim) {
					System.out.println("No");
					break;
				}
				if (nums[i-1] - nums[i] < -1) {
					lim = nums[i]-1;

				}
				if (i == N-1) {
					System.out.println("Yes");
					break;
				}

			}
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] nums = new int[N];

		for (int i = 0; i < N; i++) {
			nums[i] = sc.nextInt();
		}
		if (nums.length == 1) {
			System.out.println("Yes");
		}else {
			int lim = nums[0];
			for (int i = 1; i < N; i++) {
				if (nums[i] < lim) {
					System.out.println("No");
					break;
				}
				if (nums[i-1] - nums[i] < -1) {
					lim = nums[i]-1;

				}
				if (i == N-1) {
					System.out.println("Yes");
					break;
				}

			}
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] nums = new int[N];

		for (int i = 0; i < N; i++) {
			nums[i] = sc.nextInt();
		}
		if (nums.length == 1) {
			System.out.println("Yes");
		}else {
			int lim = nums[0];
			for (int i = 1; i < N; i++) {
				if (nums[i] < lim) {
					System.out.println("No");
					break;
				}
				if (nums[i-1] - nums[i] < -1) {
					lim = nums[i]-1;

				}
				if (i == N-1) {
					System.out.println("Yes");
					break;
				}

			}
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] nums = new int[N]; nums new int[N] N for (int i = 0; i < N; i++) {
			nums[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			nums[i] = sc.nextInt();
		} {
			nums[i] = sc.nextInt();
		} nums[i] = sc.nextInt() nums[i] nums i sc.nextInt() sc.nextInt sc if (nums.length == 1) {
			System.out.println("Yes");
		}else {
			int lim = nums[0];
			for (int i = 1; i < N; i++) {
				if (nums[i] < lim) {
					System.out.println("No");
					break;
				}
				if (nums[i-1] - nums[i] < -1) {
					lim = nums[i]-1;

				}
				if (i == N-1) {
					System.out.println("Yes");
					break;
				}

			}
		} nums.length == 1 nums.length nums nums.length 1 {
			System.out.println("Yes");
		} System.out.println("Yes") System.out.println System.out System System.out "Yes" {
			int lim = nums[0];
			for (int i = 1; i < N; i++) {
				if (nums[i] < lim) {
					System.out.println("No");
					break;
				}
				if (nums[i-1] - nums[i] < -1) {
					lim = nums[i]-1;

				}
				if (i == N-1) {
					System.out.println("Yes");
					break;
				}

			}
		} int lim = nums[0]; lim nums[0] nums 0 for (int i = 1; i < N; i++) {
				if (nums[i] < lim) {
					System.out.println("No");
					break;
				}
				if (nums[i-1] - nums[i] < -1) {
					lim = nums[i]-1;

				}
				if (i == N-1) {
					System.out.println("Yes");
					break;
				}

			} int i = 1; int i = 1; i 1 i < N i N i++ i++ i {
				if (nums[i] < lim) {
					System.out.println("No");
					break;
				}
				if (nums[i-1] - nums[i] < -1) {
					lim = nums[i]-1;

				}
				if (i == N-1) {
					System.out.println("Yes");
					break;
				}

			} {
				if (nums[i] < lim) {
					System.out.println("No");
					break;
				}
				if (nums[i-1] - nums[i] < -1) {
					lim = nums[i]-1;

				}
				if (i == N-1) {
					System.out.println("Yes");
					break;
				}

			} if (nums[i] < lim) {
					System.out.println("No");
					break;
				} nums[i] < lim nums[i] nums i lim {
					System.out.println("No");
					break;
				} System.out.println("No") System.out.println System.out System System.out "No" break; if (nums[i-1] - nums[i] < -1) {
					lim = nums[i]-1;

				} nums[i-1] - nums[i] < -1 nums[i-1] - nums[i] nums[i-1] nums i-1 i 1 nums[i] nums i -1 1 {
					lim = nums[i]-1;

				} lim = nums[i]-1 lim nums[i]-1 nums[i] nums i 1 if (i == N-1) {
					System.out.println("Yes");
					break;
				} i == N-1 i N-1 N 1 {
					System.out.println("Yes");
					break;
				} System.out.println("Yes") System.out.println System.out System System.out "Yes" break; String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] nums = new int[N];

		for (int i = 0; i < N; i++) {
			nums[i] = sc.nextInt();
		}
		if (nums.length == 1) {
			System.out.println("Yes");
		}else {
			int lim = nums[0];
			for (int i = 1; i < N; i++) {
				if (nums[i] < lim) {
					System.out.println("No");
					break;
				}
				if (nums[i-1] - nums[i] < -1) {
					lim = nums[i]-1;

				}
				if (i == N-1) {
					System.out.println("Yes");
					break;
				}

			}
		}
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] nums = new int[N];

		for (int i = 0; i < N; i++) {
			nums[i] = sc.nextInt();
		}
		if (nums.length == 1) {
			System.out.println("Yes");
		}else {
			int lim = nums[0];
			for (int i = 1; i < N; i++) {
				if (nums[i] < lim) {
					System.out.println("No");
					break;
				}
				if (nums[i-1] - nums[i] < -1) {
					lim = nums[i]-1;

				}
				if (i == N-1) {
					System.out.println("Yes");
					break;
				}

			}
		}
	}
} 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[] nums = new int[N];

		for (int i = 0; i < N; i++) {
			nums[i] = sc.nextInt();
		}
		if (nums.length == 1) {
			System.out.println("Yes");
		}else {
			int lim = nums[0];
			for (int i = 1; i < N; i++) {
				if (nums[i] < lim) {
					System.out.println("No");
					break;
				}
				if (nums[i-1] - nums[i] < -1) {
					lim = nums[i]-1;

				}
				if (i == N-1) {
					System.out.println("Yes");
					break;
				}

			}
		}
	}
}


