import java.util.Scanner;

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

		int N = sc.nextInt();
		int[] cell = new int[N];
		int max = 0;
		String ans = "Yes";
		
		for(int i = 1; i <= N; i++) {
			cell[i-1] = sc.nextInt();
		}
		
		for(int j = 1; j <= N; j++) {
			if(max <= cell[j-1]) {
				max = cell[j-1];
			} else {
				if(max -1 > cell[j-1]) {
					
					ans = "No";
				}
			}
		}
		
		System.out.println(ans);
	}

} 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[] cell = new int[N];
		int max = 0;
		String ans = "Yes";
		
		for(int i = 1; i <= N; i++) {
			cell[i-1] = sc.nextInt();
		}
		
		for(int j = 1; j <= N; j++) {
			if(max <= cell[j-1]) {
				max = cell[j-1];
			} else {
				if(max -1 > cell[j-1]) {
					
					ans = "No";
				}
			}
		}
		
		System.out.println(ans);
	}

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

		int N = sc.nextInt();
		int[] cell = new int[N];
		int max = 0;
		String ans = "Yes";
		
		for(int i = 1; i <= N; i++) {
			cell[i-1] = sc.nextInt();
		}
		
		for(int j = 1; j <= N; j++) {
			if(max <= cell[j-1]) {
				max = cell[j-1];
			} else {
				if(max -1 > cell[j-1]) {
					
					ans = "No";
				}
			}
		}
		
		System.out.println(ans);
	} main {
		
		Scanner sc = new Scanner(System.in);

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

		int N = sc.nextInt();
		int[] cell = new int[N];
		int max = 0;
		String ans = "Yes";
		
		for(int i = 1; i <= N; i++) {
			cell[i-1] = sc.nextInt();
		}
		
		for(int j = 1; j <= N; j++) {
			if(max <= cell[j-1]) {
				max = cell[j-1];
			} else {
				if(max -1 > cell[j-1]) {
					
					ans = "No";
				}
			}
		}
		
		System.out.println(ans);
	}

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

		int N = sc.nextInt();
		int[] cell = new int[N];
		int max = 0;
		String ans = "Yes";
		
		for(int i = 1; i <= N; i++) {
			cell[i-1] = sc.nextInt();
		}
		
		for(int j = 1; j <= N; j++) {
			if(max <= cell[j-1]) {
				max = cell[j-1];
			} else {
				if(max -1 > cell[j-1]) {
					
					ans = "No";
				}
			}
		}
		
		System.out.println(ans);
	}

} 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[] cell = new int[N];
		int max = 0;
		String ans = "Yes";
		
		for(int i = 1; i <= N; i++) {
			cell[i-1] = sc.nextInt();
		}
		
		for(int j = 1; j <= N; j++) {
			if(max <= cell[j-1]) {
				max = cell[j-1];
			} else {
				if(max -1 > cell[j-1]) {
					
					ans = "No";
				}
			}
		}
		
		System.out.println(ans);
	}

}
