import java.util.Scanner;

public class Main {

	static int n;
	static int[] a = new int[100_000];

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = Integer.parseInt(sc.next());
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sc.next());
		}

		boolean isStairs = true;
		for (int i = n - 1; i > 1; i--) {
			if (a[i] >= a[i - 1]) {
				continue;
			} else if (a[i] + 1 == a[i - 1]) {
				a[i - 1]--;
			} else {
				isStairs = false;
				break;
			}
		}

		if (n == 1)
			isStairs = true;

		String ans = isStairs ? "Yes" : "No";
		System.out.println(ans);

	}

} import java.util.Scanner; Scanner java.util public class Main {

	static int n;
	static int[] a = new int[100_000];

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = Integer.parseInt(sc.next());
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sc.next());
		}

		boolean isStairs = true;
		for (int i = n - 1; i > 1; i--) {
			if (a[i] >= a[i - 1]) {
				continue;
			} else if (a[i] + 1 == a[i - 1]) {
				a[i - 1]--;
			} else {
				isStairs = false;
				break;
			}
		}

		if (n == 1)
			isStairs = true;

		String ans = isStairs ? "Yes" : "No";
		System.out.println(ans);

	}

} Main static int n; n static int[] a = new int[100_000]; a new int[100_000] 100_000 public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = Integer.parseInt(sc.next());
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sc.next());
		}

		boolean isStairs = true;
		for (int i = n - 1; i > 1; i--) {
			if (a[i] >= a[i - 1]) {
				continue;
			} else if (a[i] + 1 == a[i - 1]) {
				a[i - 1]--;
			} else {
				isStairs = false;
				break;
			}
		}

		if (n == 1)
			isStairs = true;

		String ans = isStairs ? "Yes" : "No";
		System.out.println(ans);

	} main {
		Scanner sc = new Scanner(System.in);
		n = Integer.parseInt(sc.next());
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sc.next());
		}

		boolean isStairs = true;
		for (int i = n - 1; i > 1; i--) {
			if (a[i] >= a[i - 1]) {
				continue;
			} else if (a[i] + 1 == a[i - 1]) {
				a[i - 1]--;
			} else {
				isStairs = false;
				break;
			}
		}

		if (n == 1)
			isStairs = true;

		String ans = isStairs ? "Yes" : "No";
		System.out.println(ans);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) n = Integer.parseInt(sc.next()) n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sc.next());
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			a[i] = Integer.parseInt(sc.next());
		} {
			a[i] = Integer.parseInt(sc.next());
		} a[i] = Integer.parseInt(sc.next()) a[i] a i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc boolean isStairs = true; isStairs true for (int i = n - 1; i > 1; i--) {
			if (a[i] >= a[i - 1]) {
				continue;
			} else if (a[i] + 1 == a[i - 1]) {
				a[i - 1]--;
			} else {
				isStairs = false;
				break;
			}
		} int i = n - 1; int i = n - 1; i n - 1 n 1 i > 1 i 1 i-- i-- i {
			if (a[i] >= a[i - 1]) {
				continue;
			} else if (a[i] + 1 == a[i - 1]) {
				a[i - 1]--;
			} else {
				isStairs = false;
				break;
			}
		} {
			if (a[i] >= a[i - 1]) {
				continue;
			} else if (a[i] + 1 == a[i - 1]) {
				a[i - 1]--;
			} else {
				isStairs = false;
				break;
			}
		} if (a[i] >= a[i - 1]) {
				continue;
			} else if (a[i] + 1 == a[i - 1]) {
				a[i - 1]--;
			} else {
				isStairs = false;
				break;
			} a[i] >= a[i - 1] a[i] a i a[i - 1] a i - 1 i 1 {
				continue;
			} continue; if (a[i] + 1 == a[i - 1]) {
				a[i - 1]--;
			} else {
				isStairs = false;
				break;
			} a[i] + 1 == a[i - 1] a[i] + 1 a[i] a i 1 a[i - 1] a i - 1 i 1 {
				a[i - 1]--;
			} a[i - 1]-- a[i - 1] a i - 1 i 1 {
				isStairs = false;
				break;
			} isStairs = false isStairs false break; if (n == 1)
			isStairs = true; n == 1 n 1 isStairs = true isStairs true String ans = isStairs ? "Yes" : "No"; ans isStairs ? "Yes" : "No" isStairs "Yes" "No" System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

	static int n;
	static int[] a = new int[100_000];

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = Integer.parseInt(sc.next());
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sc.next());
		}

		boolean isStairs = true;
		for (int i = n - 1; i > 1; i--) {
			if (a[i] >= a[i - 1]) {
				continue;
			} else if (a[i] + 1 == a[i - 1]) {
				a[i - 1]--;
			} else {
				isStairs = false;
				break;
			}
		}

		if (n == 1)
			isStairs = true;

		String ans = isStairs ? "Yes" : "No";
		System.out.println(ans);

	}

} public class Main {

	static int n;
	static int[] a = new int[100_000];

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = Integer.parseInt(sc.next());
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sc.next());
		}

		boolean isStairs = true;
		for (int i = n - 1; i > 1; i--) {
			if (a[i] >= a[i - 1]) {
				continue;
			} else if (a[i] + 1 == a[i - 1]) {
				a[i - 1]--;
			} else {
				isStairs = false;
				break;
			}
		}

		if (n == 1)
			isStairs = true;

		String ans = isStairs ? "Yes" : "No";
		System.out.println(ans);

	}

} Main
import java.util.Scanner;

public class Main {

	static int n;
	static int[] a = new int[100_000];

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = Integer.parseInt(sc.next());
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sc.next());
		}

		boolean isStairs = true;
		for (int i = n - 1; i > 1; i--) {
			if (a[i] >= a[i - 1]) {
				continue;
			} else if (a[i] + 1 == a[i - 1]) {
				a[i - 1]--;
			} else {
				isStairs = false;
				break;
			}
		}

		if (n == 1)
			isStairs = true;

		String ans = isStairs ? "Yes" : "No";
		System.out.println(ans);

	}

}
