import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long H[] = new long[N];
		for (int i = 0; i < H.length; i++) {
			H[i] = sc.nextLong();
		}

		long max = H[0];
		for (int i = 0; i < H.length-1; i++) {
			if (max-H[i+1] >1) {
				System.out.println("No");
				return;
			} else if (max == H[i+1]) {
				continue;
			} else if (max-H[i+1] == 1) {
				continue;
			} else {
				max = H[i+1];
			}

		}
		System.out.println("Yes");
	}
} 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();
		long H[] = new long[N];
		for (int i = 0; i < H.length; i++) {
			H[i] = sc.nextLong();
		}

		long max = H[0];
		for (int i = 0; i < H.length-1; i++) {
			if (max-H[i+1] >1) {
				System.out.println("No");
				return;
			} else if (max == H[i+1]) {
				continue;
			} else if (max-H[i+1] == 1) {
				continue;
			} else {
				max = H[i+1];
			}

		}
		System.out.println("Yes");
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long H[] = new long[N];
		for (int i = 0; i < H.length; i++) {
			H[i] = sc.nextLong();
		}

		long max = H[0];
		for (int i = 0; i < H.length-1; i++) {
			if (max-H[i+1] >1) {
				System.out.println("No");
				return;
			} else if (max == H[i+1]) {
				continue;
			} else if (max-H[i+1] == 1) {
				continue;
			} else {
				max = H[i+1];
			}

		}
		System.out.println("Yes");
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long H[] = new long[N];
		for (int i = 0; i < H.length; i++) {
			H[i] = sc.nextLong();
		}

		long max = H[0];
		for (int i = 0; i < H.length-1; i++) {
			if (max-H[i+1] >1) {
				System.out.println("No");
				return;
			} else if (max == H[i+1]) {
				continue;
			} else if (max-H[i+1] == 1) {
				continue;
			} else {
				max = H[i+1];
			}

		}
		System.out.println("Yes");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc long H[] = new long[N]; H new long[N] N for (int i = 0; i < H.length; i++) {
			H[i] = sc.nextLong();
		} int i = 0; int i = 0; i 0 i < H.length i H.length H H.length i++ i++ i {
			H[i] = sc.nextLong();
		} {
			H[i] = sc.nextLong();
		} H[i] = sc.nextLong() H[i] H i sc.nextLong() sc.nextLong sc long max = H[0]; max H[0] H 0 for (int i = 0; i < H.length-1; i++) {
			if (max-H[i+1] >1) {
				System.out.println("No");
				return;
			} else if (max == H[i+1]) {
				continue;
			} else if (max-H[i+1] == 1) {
				continue;
			} else {
				max = H[i+1];
			}

		} int i = 0; int i = 0; i 0 i < H.length-1 i H.length-1 H.length H H.length 1 i++ i++ i {
			if (max-H[i+1] >1) {
				System.out.println("No");
				return;
			} else if (max == H[i+1]) {
				continue;
			} else if (max-H[i+1] == 1) {
				continue;
			} else {
				max = H[i+1];
			}

		} {
			if (max-H[i+1] >1) {
				System.out.println("No");
				return;
			} else if (max == H[i+1]) {
				continue;
			} else if (max-H[i+1] == 1) {
				continue;
			} else {
				max = H[i+1];
			}

		} if (max-H[i+1] >1) {
				System.out.println("No");
				return;
			} else if (max == H[i+1]) {
				continue;
			} else if (max-H[i+1] == 1) {
				continue;
			} else {
				max = H[i+1];
			} max-H[i+1] >1 max-H[i+1] max H[i+1] H i+1 i 1 1 {
				System.out.println("No");
				return;
			} System.out.println("No") System.out.println System.out System System.out "No" return; if (max == H[i+1]) {
				continue;
			} else if (max-H[i+1] == 1) {
				continue;
			} else {
				max = H[i+1];
			} max == H[i+1] max H[i+1] H i+1 i 1 {
				continue;
			} continue; if (max-H[i+1] == 1) {
				continue;
			} else {
				max = H[i+1];
			} max-H[i+1] == 1 max-H[i+1] max H[i+1] H i+1 i 1 1 {
				continue;
			} continue; {
				max = H[i+1];
			} max = H[i+1] max H[i+1] H i+1 i 1 System.out.println("Yes") System.out.println System.out System System.out "Yes" String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long H[] = new long[N];
		for (int i = 0; i < H.length; i++) {
			H[i] = sc.nextLong();
		}

		long max = H[0];
		for (int i = 0; i < H.length-1; i++) {
			if (max-H[i+1] >1) {
				System.out.println("No");
				return;
			} else if (max == H[i+1]) {
				continue;
			} else if (max-H[i+1] == 1) {
				continue;
			} else {
				max = H[i+1];
			}

		}
		System.out.println("Yes");
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long H[] = new long[N];
		for (int i = 0; i < H.length; i++) {
			H[i] = sc.nextLong();
		}

		long max = H[0];
		for (int i = 0; i < H.length-1; i++) {
			if (max-H[i+1] >1) {
				System.out.println("No");
				return;
			} else if (max == H[i+1]) {
				continue;
			} else if (max-H[i+1] == 1) {
				continue;
			} else {
				max = H[i+1];
			}

		}
		System.out.println("Yes");
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long H[] = new long[N];
		for (int i = 0; i < H.length; i++) {
			H[i] = sc.nextLong();
		}

		long max = H[0];
		for (int i = 0; i < H.length-1; i++) {
			if (max-H[i+1] >1) {
				System.out.println("No");
				return;
			} else if (max == H[i+1]) {
				continue;
			} else if (max-H[i+1] == 1) {
				continue;
			} else {
				max = H[i+1];
			}

		}
		System.out.println("Yes");
	}
}
