
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		String line = sc.nextLine();
		int N = Integer.parseInt(line);
		line = sc.nextLine();
		String[] lines = line.split(" ");
		int[] H = new int[lines.length];

		for (int i = 0; i < lines.length; i++) {
			H[i] = Integer.parseInt(lines[i]);
		}

		boolean flag = true;

		for(int i=N-1; i>0; i--) {
			if(H[i]< H[i-1]) {
				if(H[i-1]-1 <= H[i]) {
					H[i-1]--;
				}else {
					flag = false;
					break;
				}
			}
		}

		if (flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

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

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		String line = sc.nextLine();
		int N = Integer.parseInt(line);
		line = sc.nextLine();
		String[] lines = line.split(" ");
		int[] H = new int[lines.length];

		for (int i = 0; i < lines.length; i++) {
			H[i] = Integer.parseInt(lines[i]);
		}

		boolean flag = true;

		for(int i=N-1; i>0; i--) {
			if(H[i]< H[i-1]) {
				if(H[i-1]-1 <= H[i]) {
					H[i-1]--;
				}else {
					flag = false;
					break;
				}
			}
		}

		if (flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		String line = sc.nextLine();
		int N = Integer.parseInt(line);
		line = sc.nextLine();
		String[] lines = line.split(" ");
		int[] H = new int[lines.length];

		for (int i = 0; i < lines.length; i++) {
			H[i] = Integer.parseInt(lines[i]);
		}

		boolean flag = true;

		for(int i=N-1; i>0; i--) {
			if(H[i]< H[i-1]) {
				if(H[i-1]-1 <= H[i]) {
					H[i-1]--;
				}else {
					flag = false;
					break;
				}
			}
		}

		if (flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		String line = sc.nextLine();
		int N = Integer.parseInt(line);
		line = sc.nextLine();
		String[] lines = line.split(" ");
		int[] H = new int[lines.length];

		for (int i = 0; i < lines.length; i++) {
			H[i] = Integer.parseInt(lines[i]);
		}

		boolean flag = true;

		for(int i=N-1; i>0; i--) {
			if(H[i]< H[i-1]) {
				if(H[i-1]-1 <= H[i]) {
					H[i-1]--;
				}else {
					flag = false;
					break;
				}
			}
		}

		if (flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String line = sc.nextLine(); line sc.nextLine() sc.nextLine sc int N = Integer.parseInt(line); N Integer.parseInt(line) Integer.parseInt Integer line line = sc.nextLine() line sc.nextLine() sc.nextLine sc String[] lines = line.split(" "); lines line.split(" ") line.split line " " int[] H = new int[lines.length]; H new int[lines.length] lines.length lines lines.length for (int i = 0; i < lines.length; i++) {
			H[i] = Integer.parseInt(lines[i]);
		} int i = 0; int i = 0; i 0 i < lines.length i lines.length lines lines.length i++ i++ i {
			H[i] = Integer.parseInt(lines[i]);
		} {
			H[i] = Integer.parseInt(lines[i]);
		} H[i] = Integer.parseInt(lines[i]) H[i] H i Integer.parseInt(lines[i]) Integer.parseInt Integer lines[i] lines i boolean flag = true; flag true for(int i=N-1; i>0; i--) {
			if(H[i]< H[i-1]) {
				if(H[i-1]-1 <= H[i]) {
					H[i-1]--;
				}else {
					flag = false;
					break;
				}
			}
		} int i=N-1; int i=N-1; i N-1 N 1 i>0 i 0 i-- i-- i {
			if(H[i]< H[i-1]) {
				if(H[i-1]-1 <= H[i]) {
					H[i-1]--;
				}else {
					flag = false;
					break;
				}
			}
		} {
			if(H[i]< H[i-1]) {
				if(H[i-1]-1 <= H[i]) {
					H[i-1]--;
				}else {
					flag = false;
					break;
				}
			}
		} if(H[i]< H[i-1]) {
				if(H[i-1]-1 <= H[i]) {
					H[i-1]--;
				}else {
					flag = false;
					break;
				}
			} H[i]< H[i-1] H[i] H i H[i-1] H i-1 i 1 {
				if(H[i-1]-1 <= H[i]) {
					H[i-1]--;
				}else {
					flag = false;
					break;
				}
			} if(H[i-1]-1 <= H[i]) {
					H[i-1]--;
				}else {
					flag = false;
					break;
				} H[i-1]-1 <= H[i] H[i-1]-1 H[i-1] H i-1 i 1 1 H[i] H i {
					H[i-1]--;
				} H[i-1]-- H[i-1] H i-1 i 1 {
					flag = false;
					break;
				} flag = false flag false break; if (flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		} flag {
			System.out.println("Yes");
		} System.out.println("Yes") System.out.println System.out System System.out "Yes" {
			System.out.println("No");
		} System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		String line = sc.nextLine();
		int N = Integer.parseInt(line);
		line = sc.nextLine();
		String[] lines = line.split(" ");
		int[] H = new int[lines.length];

		for (int i = 0; i < lines.length; i++) {
			H[i] = Integer.parseInt(lines[i]);
		}

		boolean flag = true;

		for(int i=N-1; i>0; i--) {
			if(H[i]< H[i-1]) {
				if(H[i-1]-1 <= H[i]) {
					H[i-1]--;
				}else {
					flag = false;
					break;
				}
			}
		}

		if (flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

} public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		String line = sc.nextLine();
		int N = Integer.parseInt(line);
		line = sc.nextLine();
		String[] lines = line.split(" ");
		int[] H = new int[lines.length];

		for (int i = 0; i < lines.length; i++) {
			H[i] = Integer.parseInt(lines[i]);
		}

		boolean flag = true;

		for(int i=N-1; i>0; i--) {
			if(H[i]< H[i-1]) {
				if(H[i-1]-1 <= H[i]) {
					H[i-1]--;
				}else {
					flag = false;
					break;
				}
			}
		}

		if (flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

} Main

import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		String line = sc.nextLine();
		int N = Integer.parseInt(line);
		line = sc.nextLine();
		String[] lines = line.split(" ");
		int[] H = new int[lines.length];

		for (int i = 0; i < lines.length; i++) {
			H[i] = Integer.parseInt(lines[i]);
		}

		boolean flag = true;

		for(int i=N-1; i>0; i--) {
			if(H[i]< H[i-1]) {
				if(H[i-1]-1 <= H[i]) {
					H[i-1]--;
				}else {
					flag = false;
					break;
				}
			}
		}

		if (flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

}
