import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str[] = br.readLine().split(" ");
		int n = Integer.parseInt(str[0]);

		str = br.readLine().split(" ");
		int h[] = new int[n];

		int max = 0;
		for (int i = 0; i < n; i++) {
			h[i] = Integer.parseInt(str[i]);
			max = Math.max(h[i], max);
		}

		if (n == 1)
			System.out.println("Yes");
		else if (max - 2 >= h[n - 1])
			System.out.println("No");
		else {
			for (int i = n - 1; i > 0; i--) {
				if (h[i - 1] - h[i] >= 2) {
					System.out.println("No");
					System.exit(0);
				} else if (h[i - 1] > h[i]) {
					h[i - 1]--;
				}
			}
			System.out.println("Yes");
		}
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str[] = br.readLine().split(" ");
		int n = Integer.parseInt(str[0]);

		str = br.readLine().split(" ");
		int h[] = new int[n];

		int max = 0;
		for (int i = 0; i < n; i++) {
			h[i] = Integer.parseInt(str[i]);
			max = Math.max(h[i], max);
		}

		if (n == 1)
			System.out.println("Yes");
		else if (max - 2 >= h[n - 1])
			System.out.println("No");
		else {
			for (int i = n - 1; i > 0; i--) {
				if (h[i - 1] - h[i] >= 2) {
					System.out.println("No");
					System.exit(0);
				} else if (h[i - 1] > h[i]) {
					h[i - 1]--;
				}
			}
			System.out.println("Yes");
		}
	}
} Main public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str[] = br.readLine().split(" ");
		int n = Integer.parseInt(str[0]);

		str = br.readLine().split(" ");
		int h[] = new int[n];

		int max = 0;
		for (int i = 0; i < n; i++) {
			h[i] = Integer.parseInt(str[i]);
			max = Math.max(h[i], max);
		}

		if (n == 1)
			System.out.println("Yes");
		else if (max - 2 >= h[n - 1])
			System.out.println("No");
		else {
			for (int i = n - 1; i > 0; i--) {
				if (h[i - 1] - h[i] >= 2) {
					System.out.println("No");
					System.exit(0);
				} else if (h[i - 1] > h[i]) {
					h[i - 1]--;
				}
			}
			System.out.println("Yes");
		}
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str[] = br.readLine().split(" ");
		int n = Integer.parseInt(str[0]);

		str = br.readLine().split(" ");
		int h[] = new int[n];

		int max = 0;
		for (int i = 0; i < n; i++) {
			h[i] = Integer.parseInt(str[i]);
			max = Math.max(h[i], max);
		}

		if (n == 1)
			System.out.println("Yes");
		else if (max - 2 >= h[n - 1])
			System.out.println("No");
		else {
			for (int i = n - 1; i > 0; i--) {
				if (h[i - 1] - h[i] >= 2) {
					System.out.println("No");
					System.exit(0);
				} else if (h[i - 1] > h[i]) {
					h[i - 1]--;
				}
			}
			System.out.println("Yes");
		}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String str[] = br.readLine().split(" "); str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int n = Integer.parseInt(str[0]); n Integer.parseInt(str[0]) Integer.parseInt Integer str[0] str 0 str = br.readLine().split(" ") str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int h[] = new int[n]; h new int[n] n int max = 0; max 0 for (int i = 0; i < n; i++) {
			h[i] = Integer.parseInt(str[i]);
			max = Math.max(h[i], max);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			h[i] = Integer.parseInt(str[i]);
			max = Math.max(h[i], max);
		} {
			h[i] = Integer.parseInt(str[i]);
			max = Math.max(h[i], max);
		} h[i] = Integer.parseInt(str[i]) h[i] h i Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i max = Math.max(h[i], max) max Math.max(h[i], max) Math.max Math h[i] h i max if (n == 1)
			System.out.println("Yes");
		else if (max - 2 >= h[n - 1])
			System.out.println("No");
		else {
			for (int i = n - 1; i > 0; i--) {
				if (h[i - 1] - h[i] >= 2) {
					System.out.println("No");
					System.exit(0);
				} else if (h[i - 1] > h[i]) {
					h[i - 1]--;
				}
			}
			System.out.println("Yes");
		} n == 1 n 1 System.out.println("Yes") System.out.println System.out System System.out "Yes" if (max - 2 >= h[n - 1])
			System.out.println("No");
		else {
			for (int i = n - 1; i > 0; i--) {
				if (h[i - 1] - h[i] >= 2) {
					System.out.println("No");
					System.exit(0);
				} else if (h[i - 1] > h[i]) {
					h[i - 1]--;
				}
			}
			System.out.println("Yes");
		} max - 2 >= h[n - 1] max - 2 max 2 h[n - 1] h n - 1 n 1 System.out.println("No") System.out.println System.out System System.out "No" {
			for (int i = n - 1; i > 0; i--) {
				if (h[i - 1] - h[i] >= 2) {
					System.out.println("No");
					System.exit(0);
				} else if (h[i - 1] > h[i]) {
					h[i - 1]--;
				}
			}
			System.out.println("Yes");
		} for (int i = n - 1; i > 0; i--) {
				if (h[i - 1] - h[i] >= 2) {
					System.out.println("No");
					System.exit(0);
				} else if (h[i - 1] > h[i]) {
					h[i - 1]--;
				}
			} int i = n - 1; int i = n - 1; i n - 1 n 1 i > 0 i 0 i-- i-- i {
				if (h[i - 1] - h[i] >= 2) {
					System.out.println("No");
					System.exit(0);
				} else if (h[i - 1] > h[i]) {
					h[i - 1]--;
				}
			} {
				if (h[i - 1] - h[i] >= 2) {
					System.out.println("No");
					System.exit(0);
				} else if (h[i - 1] > h[i]) {
					h[i - 1]--;
				}
			} if (h[i - 1] - h[i] >= 2) {
					System.out.println("No");
					System.exit(0);
				} else if (h[i - 1] > h[i]) {
					h[i - 1]--;
				} h[i - 1] - h[i] >= 2 h[i - 1] - h[i] h[i - 1] h i - 1 i 1 h[i] h i 2 {
					System.out.println("No");
					System.exit(0);
				} System.out.println("No") System.out.println System.out System System.out "No" System.exit(0) System.exit System 0 if (h[i - 1] > h[i]) {
					h[i - 1]--;
				} h[i - 1] > h[i] h[i - 1] h i - 1 i 1 h[i] h i {
					h[i - 1]--;
				} h[i - 1]-- 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[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str[] = br.readLine().split(" ");
		int n = Integer.parseInt(str[0]);

		str = br.readLine().split(" ");
		int h[] = new int[n];

		int max = 0;
		for (int i = 0; i < n; i++) {
			h[i] = Integer.parseInt(str[i]);
			max = Math.max(h[i], max);
		}

		if (n == 1)
			System.out.println("Yes");
		else if (max - 2 >= h[n - 1])
			System.out.println("No");
		else {
			for (int i = n - 1; i > 0; i--) {
				if (h[i - 1] - h[i] >= 2) {
					System.out.println("No");
					System.exit(0);
				} else if (h[i - 1] > h[i]) {
					h[i - 1]--;
				}
			}
			System.out.println("Yes");
		}
	}
} public class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str[] = br.readLine().split(" ");
		int n = Integer.parseInt(str[0]);

		str = br.readLine().split(" ");
		int h[] = new int[n];

		int max = 0;
		for (int i = 0; i < n; i++) {
			h[i] = Integer.parseInt(str[i]);
			max = Math.max(h[i], max);
		}

		if (n == 1)
			System.out.println("Yes");
		else if (max - 2 >= h[n - 1])
			System.out.println("No");
		else {
			for (int i = n - 1; i > 0; i--) {
				if (h[i - 1] - h[i] >= 2) {
					System.out.println("No");
					System.exit(0);
				} else if (h[i - 1] > h[i]) {
					h[i - 1]--;
				}
			}
			System.out.println("Yes");
		}
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str[] = br.readLine().split(" ");
		int n = Integer.parseInt(str[0]);

		str = br.readLine().split(" ");
		int h[] = new int[n];

		int max = 0;
		for (int i = 0; i < n; i++) {
			h[i] = Integer.parseInt(str[i]);
			max = Math.max(h[i], max);
		}

		if (n == 1)
			System.out.println("Yes");
		else if (max - 2 >= h[n - 1])
			System.out.println("No");
		else {
			for (int i = n - 1; i > 0; i--) {
				if (h[i - 1] - h[i] >= 2) {
					System.out.println("No");
					System.exit(0);
				} else if (h[i - 1] > h[i]) {
					h[i - 1]--;
				}
			}
			System.out.println("Yes");
		}
	}
}