import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		String ans = "Yes";

		int prev = 0;
		int max = 0;
		for(int i = 0; i < num; i++){
			int height = sc.nextInt();
			if(prev-1 > height){
				ans = "No";
				break;
			}else if(prev > height){
				if(height < max-1){
					ans = "No";
					break;
				}
			}
			max = Math.max(height, max);
			prev = height;
		}
		
		System.out.println(ans);
	}
}

 import java.util.*; util.* java class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		String ans = "Yes";

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

		int prev = 0;
		int max = 0;
		for(int i = 0; i < num; i++){
			int height = sc.nextInt();
			if(prev-1 > height){
				ans = "No";
				break;
			}else if(prev > height){
				if(height < max-1){
					ans = "No";
					break;
				}
			}
			max = Math.max(height, max);
			prev = height;
		}
		
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		String ans = "Yes";

		int prev = 0;
		int max = 0;
		for(int i = 0; i < num; i++){
			int height = sc.nextInt();
			if(prev-1 > height){
				ans = "No";
				break;
			}else if(prev > height){
				if(height < max-1){
					ans = "No";
					break;
				}
			}
			max = Math.max(height, max);
			prev = height;
		}
		
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int num = sc.nextInt(); num sc.nextInt() sc.nextInt sc String ans = "Yes"; ans "Yes" int prev = 0; prev 0 int max = 0; max 0 for(int i = 0; i < num; i++){
			int height = sc.nextInt();
			if(prev-1 > height){
				ans = "No";
				break;
			}else if(prev > height){
				if(height < max-1){
					ans = "No";
					break;
				}
			}
			max = Math.max(height, max);
			prev = height;
		} int i = 0; int i = 0; i 0 i < num i num i++ i++ i {
			int height = sc.nextInt();
			if(prev-1 > height){
				ans = "No";
				break;
			}else if(prev > height){
				if(height < max-1){
					ans = "No";
					break;
				}
			}
			max = Math.max(height, max);
			prev = height;
		} {
			int height = sc.nextInt();
			if(prev-1 > height){
				ans = "No";
				break;
			}else if(prev > height){
				if(height < max-1){
					ans = "No";
					break;
				}
			}
			max = Math.max(height, max);
			prev = height;
		} int height = sc.nextInt(); height sc.nextInt() sc.nextInt sc if(prev-1 > height){
				ans = "No";
				break;
			}else if(prev > height){
				if(height < max-1){
					ans = "No";
					break;
				}
			} prev-1 > height prev-1 prev 1 height {
				ans = "No";
				break;
			} ans = "No" ans "No" break; if(prev > height){
				if(height < max-1){
					ans = "No";
					break;
				}
			} prev > height prev height {
				if(height < max-1){
					ans = "No";
					break;
				}
			} if(height < max-1){
					ans = "No";
					break;
				} height < max-1 height max-1 max 1 {
					ans = "No";
					break;
				} ans = "No" ans "No" break; max = Math.max(height, max) max Math.max(height, max) Math.max Math height max prev = height prev height System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		String ans = "Yes";

		int prev = 0;
		int max = 0;
		for(int i = 0; i < num; i++){
			int height = sc.nextInt();
			if(prev-1 > height){
				ans = "No";
				break;
			}else if(prev > height){
				if(height < max-1){
					ans = "No";
					break;
				}
			}
			max = Math.max(height, max);
			prev = height;
		}
		
		System.out.println(ans);
	}
}


