import java.util.Scanner;

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

		// 整数の入力
		int n = sc.nextInt();

		int h[] = new int[n];

		/* 配列に読み込み */
		for(int i = 0; i < n; i++) {
			h[i] = sc.nextInt();
		}

		int i = 1;
		int j = 1;

		while(i < n) {
			if(h[i-1] <= h[i]) {
				i++;
				continue;
			} else {
				if(j > i) {
					System.out.println("No");
					System.exit(0);
				} else {
					i = j++;

					h[i-1]--;

					if(i > 1 && h[i-2] > h[i-1]) {
						h[i-1]++;
					}
				}
			}
		}

		System.out.println("Yes");

        sc.close();
	}
} 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();

		int h[] = new int[n];

		/* 配列に読み込み */
		for(int i = 0; i < n; i++) {
			h[i] = sc.nextInt();
		}

		int i = 1;
		int j = 1;

		while(i < n) {
			if(h[i-1] <= h[i]) {
				i++;
				continue;
			} else {
				if(j > i) {
					System.out.println("No");
					System.exit(0);
				} else {
					i = j++;

					h[i-1]--;

					if(i > 1 && h[i-2] > h[i-1]) {
						h[i-1]++;
					}
				}
			}
		}

		System.out.println("Yes");

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

		// 整数の入力
		int n = sc.nextInt();

		int h[] = new int[n];

		/* 配列に読み込み */
		for(int i = 0; i < n; i++) {
			h[i] = sc.nextInt();
		}

		int i = 1;
		int j = 1;

		while(i < n) {
			if(h[i-1] <= h[i]) {
				i++;
				continue;
			} else {
				if(j > i) {
					System.out.println("No");
					System.exit(0);
				} else {
					i = j++;

					h[i-1]--;

					if(i > 1 && h[i-2] > h[i-1]) {
						h[i-1]++;
					}
				}
			}
		}

		System.out.println("Yes");

        sc.close();
	} main {
		Scanner sc = new Scanner(System.in);

		// 整数の入力
		int n = sc.nextInt();

		int h[] = new int[n];

		/* 配列に読み込み */
		for(int i = 0; i < n; i++) {
			h[i] = sc.nextInt();
		}

		int i = 1;
		int j = 1;

		while(i < n) {
			if(h[i-1] <= h[i]) {
				i++;
				continue;
			} else {
				if(j > i) {
					System.out.println("No");
					System.exit(0);
				} else {
					i = j++;

					h[i-1]--;

					if(i > 1 && h[i-2] > h[i-1]) {
						h[i-1]++;
					}
				}
			}
		}

		System.out.println("Yes");

        sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int h[] = new int[n]; h new int[n] n for(int i = 0; i < n; i++) {
			h[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			h[i] = sc.nextInt();
		} {
			h[i] = sc.nextInt();
		} h[i] = sc.nextInt() h[i] h i sc.nextInt() sc.nextInt sc int i = 1; i 1 int j = 1; j 1 while(i < n) {
			if(h[i-1] <= h[i]) {
				i++;
				continue;
			} else {
				if(j > i) {
					System.out.println("No");
					System.exit(0);
				} else {
					i = j++;

					h[i-1]--;

					if(i > 1 && h[i-2] > h[i-1]) {
						h[i-1]++;
					}
				}
			}
		} i < n i n {
			if(h[i-1] <= h[i]) {
				i++;
				continue;
			} else {
				if(j > i) {
					System.out.println("No");
					System.exit(0);
				} else {
					i = j++;

					h[i-1]--;

					if(i > 1 && h[i-2] > h[i-1]) {
						h[i-1]++;
					}
				}
			}
		} if(h[i-1] <= h[i]) {
				i++;
				continue;
			} else {
				if(j > i) {
					System.out.println("No");
					System.exit(0);
				} else {
					i = j++;

					h[i-1]--;

					if(i > 1 && h[i-2] > h[i-1]) {
						h[i-1]++;
					}
				}
			} h[i-1] <= h[i] h[i-1] h i-1 i 1 h[i] h i {
				i++;
				continue;
			} i++ i continue; {
				if(j > i) {
					System.out.println("No");
					System.exit(0);
				} else {
					i = j++;

					h[i-1]--;

					if(i > 1 && h[i-2] > h[i-1]) {
						h[i-1]++;
					}
				}
			} if(j > i) {
					System.out.println("No");
					System.exit(0);
				} else {
					i = j++;

					h[i-1]--;

					if(i > 1 && h[i-2] > h[i-1]) {
						h[i-1]++;
					}
				} j > i j i {
					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 {
					i = j++;

					h[i-1]--;

					if(i > 1 && h[i-2] > h[i-1]) {
						h[i-1]++;
					}
				} i = j++ i j++ j h[i-1]-- h[i-1] h i-1 i 1 if(i > 1 && h[i-2] > h[i-1]) {
						h[i-1]++;
					} i > 1 && h[i-2] > h[i-1] i > 1 i 1 h[i-2] > h[i-1] h[i-2] h i-2 i 2 h[i-1] h i-1 i 1 {
						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" sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		// 整数の入力
		int n = sc.nextInt();

		int h[] = new int[n];

		/* 配列に読み込み */
		for(int i = 0; i < n; i++) {
			h[i] = sc.nextInt();
		}

		int i = 1;
		int j = 1;

		while(i < n) {
			if(h[i-1] <= h[i]) {
				i++;
				continue;
			} else {
				if(j > i) {
					System.out.println("No");
					System.exit(0);
				} else {
					i = j++;

					h[i-1]--;

					if(i > 1 && h[i-2] > h[i-1]) {
						h[i-1]++;
					}
				}
			}
		}

		System.out.println("Yes");

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

		// 整数の入力
		int n = sc.nextInt();

		int h[] = new int[n];

		/* 配列に読み込み */
		for(int i = 0; i < n; i++) {
			h[i] = sc.nextInt();
		}

		int i = 1;
		int j = 1;

		while(i < n) {
			if(h[i-1] <= h[i]) {
				i++;
				continue;
			} else {
				if(j > i) {
					System.out.println("No");
					System.exit(0);
				} else {
					i = j++;

					h[i-1]--;

					if(i > 1 && h[i-2] > h[i-1]) {
						h[i-1]++;
					}
				}
			}
		}

		System.out.println("Yes");

        sc.close();
	}
} Main
import java.util.Scanner;

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

		// 整数の入力
		int n = sc.nextInt();

		int h[] = new int[n];

		/* 配列に読み込み */
		for(int i = 0; i < n; i++) {
			h[i] = sc.nextInt();
		}

		int i = 1;
		int j = 1;

		while(i < n) {
			if(h[i-1] <= h[i]) {
				i++;
				continue;
			} else {
				if(j > i) {
					System.out.println("No");
					System.exit(0);
				} else {
					i = j++;

					h[i-1]--;

					if(i > 1 && h[i-2] > h[i-1]) {
						h[i-1]++;
					}
				}
			}
		}

		System.out.println("Yes");

        sc.close();
	}
}