	import java.util.*;

	public class Main{
			
			public static void main(String args[]){
			
				Scanner sc = new Scanner(System.in);
				int n = sc.nextInt();
				
				int heights[] = new int[n];
				
				for(int i = 0; i < n; i++){
					
					heights[i] = sc.nextInt();
					
				}
				
				int flag = 1;
				
				for(int i = n-1; i > 0 ; i--) {
						
					if(heights[i] < heights[i-1]){

						heights[i-1]-=1;
						
						if(heights[i] < heights[i-1]){
	
							flag = 0;
							break;
						
						} else {
							
							continue;		
						
						}
						
					} else {

							continue;
				
					}						
				
				}
					
					if(flag == 1){
						
						System.out.println("Yes");
						
					} else {
						
						System.out.println("No");
						
					}
				
			
			}
	} import java.util.*; util.* java public class Main{
			
			public static void main(String args[]){
			
				Scanner sc = new Scanner(System.in);
				int n = sc.nextInt();
				
				int heights[] = new int[n];
				
				for(int i = 0; i < n; i++){
					
					heights[i] = sc.nextInt();
					
				}
				
				int flag = 1;
				
				for(int i = n-1; i > 0 ; i--) {
						
					if(heights[i] < heights[i-1]){

						heights[i-1]-=1;
						
						if(heights[i] < heights[i-1]){
	
							flag = 0;
							break;
						
						} else {
							
							continue;		
						
						}
						
					} else {

							continue;
				
					}						
				
				}
					
					if(flag == 1){
						
						System.out.println("Yes");
						
					} else {
						
						System.out.println("No");
						
					}
				
			
			}
	} Main public static void main(String args[]){
			
				Scanner sc = new Scanner(System.in);
				int n = sc.nextInt();
				
				int heights[] = new int[n];
				
				for(int i = 0; i < n; i++){
					
					heights[i] = sc.nextInt();
					
				}
				
				int flag = 1;
				
				for(int i = n-1; i > 0 ; i--) {
						
					if(heights[i] < heights[i-1]){

						heights[i-1]-=1;
						
						if(heights[i] < heights[i-1]){
	
							flag = 0;
							break;
						
						} else {
							
							continue;		
						
						}
						
					} else {

							continue;
				
					}						
				
				}
					
					if(flag == 1){
						
						System.out.println("Yes");
						
					} else {
						
						System.out.println("No");
						
					}
				
			
			} main {
			
				Scanner sc = new Scanner(System.in);
				int n = sc.nextInt();
				
				int heights[] = new int[n];
				
				for(int i = 0; i < n; i++){
					
					heights[i] = sc.nextInt();
					
				}
				
				int flag = 1;
				
				for(int i = n-1; i > 0 ; i--) {
						
					if(heights[i] < heights[i-1]){

						heights[i-1]-=1;
						
						if(heights[i] < heights[i-1]){
	
							flag = 0;
							break;
						
						} else {
							
							continue;		
						
						}
						
					} else {

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

						heights[i-1]-=1;
						
						if(heights[i] < heights[i-1]){
	
							flag = 0;
							break;
						
						} else {
							
							continue;		
						
						}
						
					} else {

							continue;
				
					}						
				
				} int i = n-1; int i = n-1; i n-1 n 1 i > 0 i 0 i-- i-- i {
						
					if(heights[i] < heights[i-1]){

						heights[i-1]-=1;
						
						if(heights[i] < heights[i-1]){
	
							flag = 0;
							break;
						
						} else {
							
							continue;		
						
						}
						
					} else {

							continue;
				
					}						
				
				} {
						
					if(heights[i] < heights[i-1]){

						heights[i-1]-=1;
						
						if(heights[i] < heights[i-1]){
	
							flag = 0;
							break;
						
						} else {
							
							continue;		
						
						}
						
					} else {

							continue;
				
					}						
				
				} if(heights[i] < heights[i-1]){

						heights[i-1]-=1;
						
						if(heights[i] < heights[i-1]){
	
							flag = 0;
							break;
						
						} else {
							
							continue;		
						
						}
						
					} else {

							continue;
				
					} heights[i] < heights[i-1] heights[i] heights i heights[i-1] heights i-1 i 1 {

						heights[i-1]-=1;
						
						if(heights[i] < heights[i-1]){
	
							flag = 0;
							break;
						
						} else {
							
							continue;		
						
						}
						
					} heights[i-1]-=1 heights[i-1] heights i-1 i 1 1 if(heights[i] < heights[i-1]){
	
							flag = 0;
							break;
						
						} else {
							
							continue;		
						
						} heights[i] < heights[i-1] heights[i] heights i heights[i-1] heights i-1 i 1 {
	
							flag = 0;
							break;
						
						} flag = 0 flag 0 break; {
							
							continue;		
						
						} continue; {

							continue;
				
					} continue; if(flag == 1){
						
						System.out.println("Yes");
						
					} else {
						
						System.out.println("No");
						
					} flag == 1 flag 1 {
						
						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[]){
			
				Scanner sc = new Scanner(System.in);
				int n = sc.nextInt();
				
				int heights[] = new int[n];
				
				for(int i = 0; i < n; i++){
					
					heights[i] = sc.nextInt();
					
				}
				
				int flag = 1;
				
				for(int i = n-1; i > 0 ; i--) {
						
					if(heights[i] < heights[i-1]){

						heights[i-1]-=1;
						
						if(heights[i] < heights[i-1]){
	
							flag = 0;
							break;
						
						} else {
							
							continue;		
						
						}
						
					} else {

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

						heights[i-1]-=1;
						
						if(heights[i] < heights[i-1]){
	
							flag = 0;
							break;
						
						} else {
							
							continue;		
						
						}
						
					} else {

							continue;
				
					}						
				
				}
					
					if(flag == 1){
						
						System.out.println("Yes");
						
					} else {
						
						System.out.println("No");
						
					}
				
			
			}
	} Main
	import java.util.*;

	public class Main{
			
			public static void main(String args[]){
			
				Scanner sc = new Scanner(System.in);
				int n = sc.nextInt();
				
				int heights[] = new int[n];
				
				for(int i = 0; i < n; i++){
					
					heights[i] = sc.nextInt();
					
				}
				
				int flag = 1;
				
				for(int i = n-1; i > 0 ; i--) {
						
					if(heights[i] < heights[i-1]){

						heights[i-1]-=1;
						
						if(heights[i] < heights[i-1]){
	
							flag = 0;
							break;
						
						} else {
							
							continue;		
						
						}
						
					} else {

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