import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		boolean result = true;

		int left = 0;
		int mid = sc.nextInt();	// 1個目
		int right = 0;

		for (int i = 0; i < N - 1; i++) {
			right = sc.nextInt();

			if (mid - 1 > right) {
				result = false;
				break;
			} else if (mid - 1 == right && left > mid - 1) {
				result = false;
				break;
			}

			if (left == mid) {
				left = mid;
				mid = right;
			} else {
				left = mid - 1;
				mid = right;
			}
		}

		System.out.println(result ? "Yes" : "No");
	}
} 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();
		boolean result = true;

		int left = 0;
		int mid = sc.nextInt();	// 1個目
		int right = 0;

		for (int i = 0; i < N - 1; i++) {
			right = sc.nextInt();

			if (mid - 1 > right) {
				result = false;
				break;
			} else if (mid - 1 == right && left > mid - 1) {
				result = false;
				break;
			}

			if (left == mid) {
				left = mid;
				mid = right;
			} else {
				left = mid - 1;
				mid = right;
			}
		}

		System.out.println(result ? "Yes" : "No");
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		boolean result = true;

		int left = 0;
		int mid = sc.nextInt();	// 1個目
		int right = 0;

		for (int i = 0; i < N - 1; i++) {
			right = sc.nextInt();

			if (mid - 1 > right) {
				result = false;
				break;
			} else if (mid - 1 == right && left > mid - 1) {
				result = false;
				break;
			}

			if (left == mid) {
				left = mid;
				mid = right;
			} else {
				left = mid - 1;
				mid = right;
			}
		}

		System.out.println(result ? "Yes" : "No");
	} main {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		boolean result = true;

		int left = 0;
		int mid = sc.nextInt();	// 1個目
		int right = 0;

		for (int i = 0; i < N - 1; i++) {
			right = sc.nextInt();

			if (mid - 1 > right) {
				result = false;
				break;
			} else if (mid - 1 == right && left > mid - 1) {
				result = false;
				break;
			}

			if (left == mid) {
				left = mid;
				mid = right;
			} else {
				left = mid - 1;
				mid = right;
			}
		}

		System.out.println(result ? "Yes" : "No");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc boolean result = true; result true int left = 0; left 0 int mid = sc.nextInt(); mid sc.nextInt() sc.nextInt sc int right = 0; right 0 for (int i = 0; i < N - 1; i++) {
			right = sc.nextInt();

			if (mid - 1 > right) {
				result = false;
				break;
			} else if (mid - 1 == right && left > mid - 1) {
				result = false;
				break;
			}

			if (left == mid) {
				left = mid;
				mid = right;
			} else {
				left = mid - 1;
				mid = right;
			}
		} int i = 0; int i = 0; i 0 i < N - 1 i N - 1 N 1 i++ i++ i {
			right = sc.nextInt();

			if (mid - 1 > right) {
				result = false;
				break;
			} else if (mid - 1 == right && left > mid - 1) {
				result = false;
				break;
			}

			if (left == mid) {
				left = mid;
				mid = right;
			} else {
				left = mid - 1;
				mid = right;
			}
		} {
			right = sc.nextInt();

			if (mid - 1 > right) {
				result = false;
				break;
			} else if (mid - 1 == right && left > mid - 1) {
				result = false;
				break;
			}

			if (left == mid) {
				left = mid;
				mid = right;
			} else {
				left = mid - 1;
				mid = right;
			}
		} right = sc.nextInt() right sc.nextInt() sc.nextInt sc if (mid - 1 > right) {
				result = false;
				break;
			} else if (mid - 1 == right && left > mid - 1) {
				result = false;
				break;
			} mid - 1 > right mid - 1 mid 1 right {
				result = false;
				break;
			} result = false result false break; if (mid - 1 == right && left > mid - 1) {
				result = false;
				break;
			} mid - 1 == right && left > mid - 1 mid - 1 == right mid - 1 mid 1 right left > mid - 1 left mid - 1 mid 1 {
				result = false;
				break;
			} result = false result false break; if (left == mid) {
				left = mid;
				mid = right;
			} else {
				left = mid - 1;
				mid = right;
			} left == mid left mid {
				left = mid;
				mid = right;
			} left = mid left mid mid = right mid right {
				left = mid - 1;
				mid = right;
			} left = mid - 1 left mid - 1 mid 1 mid = right mid right System.out.println(result ? "Yes" : "No") System.out.println System.out System System.out result ? "Yes" : "No" result "Yes" "No" String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		boolean result = true;

		int left = 0;
		int mid = sc.nextInt();	// 1個目
		int right = 0;

		for (int i = 0; i < N - 1; i++) {
			right = sc.nextInt();

			if (mid - 1 > right) {
				result = false;
				break;
			} else if (mid - 1 == right && left > mid - 1) {
				result = false;
				break;
			}

			if (left == mid) {
				left = mid;
				mid = right;
			} else {
				left = mid - 1;
				mid = right;
			}
		}

		System.out.println(result ? "Yes" : "No");
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		boolean result = true;

		int left = 0;
		int mid = sc.nextInt();	// 1個目
		int right = 0;

		for (int i = 0; i < N - 1; i++) {
			right = sc.nextInt();

			if (mid - 1 > right) {
				result = false;
				break;
			} else if (mid - 1 == right && left > mid - 1) {
				result = false;
				break;
			}

			if (left == mid) {
				left = mid;
				mid = right;
			} else {
				left = mid - 1;
				mid = right;
			}
		}

		System.out.println(result ? "Yes" : "No");
	}
} Main
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		boolean result = true;

		int left = 0;
		int mid = sc.nextInt();	// 1個目
		int right = 0;

		for (int i = 0; i < N - 1; i++) {
			right = sc.nextInt();

			if (mid - 1 > right) {
				result = false;
				break;
			} else if (mid - 1 == right && left > mid - 1) {
				result = false;
				break;
			}

			if (left == mid) {
				left = mid;
				mid = right;
			} else {
				left = mid - 1;
				mid = right;
			}
		}

		System.out.println(result ? "Yes" : "No");
	}
}