import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int[]h = new int[n];
		for(int i = 0; i < n; i++) {
			h[i] = stdIn.nextInt();
		}
		if(n==1) {
			System.out.println("Yes");
			System.exit(0);
		}
		int max = 0;
		
		for(int i = 0; i < n-1; i++) {
			if(max == h[i]) {
				if(h[i] > h[i+1]) {
					System.out.println("No");
					System.exit(0);
				}
			}
			if(h[i]-1 > h[i+1]) {
				System.out.println("No");
				System.exit(0);
			}
			h[i]--;
			max = Math.max(h[i], max);
		}
		System.out.println("Yes");
		
	}

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

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int[]h = new int[n];
		for(int i = 0; i < n; i++) {
			h[i] = stdIn.nextInt();
		}
		if(n==1) {
			System.out.println("Yes");
			System.exit(0);
		}
		int max = 0;
		
		for(int i = 0; i < n-1; i++) {
			if(max == h[i]) {
				if(h[i] > h[i+1]) {
					System.out.println("No");
					System.exit(0);
				}
			}
			if(h[i]-1 > h[i+1]) {
				System.out.println("No");
				System.exit(0);
			}
			h[i]--;
			max = Math.max(h[i], max);
		}
		System.out.println("Yes");
		
	}

} Main public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int[]h = new int[n];
		for(int i = 0; i < n; i++) {
			h[i] = stdIn.nextInt();
		}
		if(n==1) {
			System.out.println("Yes");
			System.exit(0);
		}
		int max = 0;
		
		for(int i = 0; i < n-1; i++) {
			if(max == h[i]) {
				if(h[i] > h[i+1]) {
					System.out.println("No");
					System.exit(0);
				}
			}
			if(h[i]-1 > h[i+1]) {
				System.out.println("No");
				System.exit(0);
			}
			h[i]--;
			max = Math.max(h[i], max);
		}
		System.out.println("Yes");
		
	} main {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int[]h = new int[n];
		for(int i = 0; i < n; i++) {
			h[i] = stdIn.nextInt();
		}
		if(n==1) {
			System.out.println("Yes");
			System.exit(0);
		}
		int max = 0;
		
		for(int i = 0; i < n-1; i++) {
			if(max == h[i]) {
				if(h[i] > h[i+1]) {
					System.out.println("No");
					System.exit(0);
				}
			}
			if(h[i]-1 > h[i+1]) {
				System.out.println("No");
				System.exit(0);
			}
			h[i]--;
			max = Math.max(h[i], max);
		}
		System.out.println("Yes");
		
	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int n = stdIn.nextInt(); n stdIn.nextInt() stdIn.nextInt stdIn int[]h = new int[n]; h new int[n] n for(int i = 0; i < n; i++) {
			h[i] = stdIn.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			h[i] = stdIn.nextInt();
		} {
			h[i] = stdIn.nextInt();
		} h[i] = stdIn.nextInt() h[i] h i stdIn.nextInt() stdIn.nextInt stdIn if(n==1) {
			System.out.println("Yes");
			System.exit(0);
		} n==1 n 1 {
			System.out.println("Yes");
			System.exit(0);
		} System.out.println("Yes") System.out.println System.out System System.out "Yes" System.exit(0) System.exit System 0 int max = 0; max 0 for(int i = 0; i < n-1; i++) {
			if(max == h[i]) {
				if(h[i] > h[i+1]) {
					System.out.println("No");
					System.exit(0);
				}
			}
			if(h[i]-1 > h[i+1]) {
				System.out.println("No");
				System.exit(0);
			}
			h[i]--;
			max = Math.max(h[i], max);
		} int i = 0; int i = 0; i 0 i < n-1 i n-1 n 1 i++ i++ i {
			if(max == h[i]) {
				if(h[i] > h[i+1]) {
					System.out.println("No");
					System.exit(0);
				}
			}
			if(h[i]-1 > h[i+1]) {
				System.out.println("No");
				System.exit(0);
			}
			h[i]--;
			max = Math.max(h[i], max);
		} {
			if(max == h[i]) {
				if(h[i] > h[i+1]) {
					System.out.println("No");
					System.exit(0);
				}
			}
			if(h[i]-1 > h[i+1]) {
				System.out.println("No");
				System.exit(0);
			}
			h[i]--;
			max = Math.max(h[i], max);
		} if(max == h[i]) {
				if(h[i] > h[i+1]) {
					System.out.println("No");
					System.exit(0);
				}
			} max == h[i] max h[i] h i {
				if(h[i] > h[i+1]) {
					System.out.println("No");
					System.exit(0);
				}
			} if(h[i] > h[i+1]) {
					System.out.println("No");
					System.exit(0);
				} h[i] > h[i+1] h[i] h i h[i+1] h i+1 i 1 {
					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+1]) {
				System.out.println("No");
				System.exit(0);
			} h[i]-1 > h[i+1] h[i]-1 h[i] h i 1 h[i+1] h i+1 i 1 {
				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 h[i]-- h[i] h i max = Math.max(h[i], max) max Math.max(h[i], max) Math.max Math h[i] h i max 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 stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int[]h = new int[n];
		for(int i = 0; i < n; i++) {
			h[i] = stdIn.nextInt();
		}
		if(n==1) {
			System.out.println("Yes");
			System.exit(0);
		}
		int max = 0;
		
		for(int i = 0; i < n-1; i++) {
			if(max == h[i]) {
				if(h[i] > h[i+1]) {
					System.out.println("No");
					System.exit(0);
				}
			}
			if(h[i]-1 > h[i+1]) {
				System.out.println("No");
				System.exit(0);
			}
			h[i]--;
			max = Math.max(h[i], max);
		}
		System.out.println("Yes");
		
	}

} public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int[]h = new int[n];
		for(int i = 0; i < n; i++) {
			h[i] = stdIn.nextInt();
		}
		if(n==1) {
			System.out.println("Yes");
			System.exit(0);
		}
		int max = 0;
		
		for(int i = 0; i < n-1; i++) {
			if(max == h[i]) {
				if(h[i] > h[i+1]) {
					System.out.println("No");
					System.exit(0);
				}
			}
			if(h[i]-1 > h[i+1]) {
				System.out.println("No");
				System.exit(0);
			}
			h[i]--;
			max = Math.max(h[i], max);
		}
		System.out.println("Yes");
		
	}

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

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int[]h = new int[n];
		for(int i = 0; i < n; i++) {
			h[i] = stdIn.nextInt();
		}
		if(n==1) {
			System.out.println("Yes");
			System.exit(0);
		}
		int max = 0;
		
		for(int i = 0; i < n-1; i++) {
			if(max == h[i]) {
				if(h[i] > h[i+1]) {
					System.out.println("No");
					System.exit(0);
				}
			}
			if(h[i]-1 > h[i+1]) {
				System.out.println("No");
				System.exit(0);
			}
			h[i]--;
			max = Math.max(h[i], max);
		}
		System.out.println("Yes");
		
	}

}
