import java.util.*; 

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 c=0;c<n;c++){
    		h[c]=sc.nextInt();
       
          }
    	
  
  		int ans=0;
  		int max=h[0];
  		
  
    for(int d=1;d<n;d++){
        if(h[d]<max-1){
            	ans++;
                break;
            }else{
        	max=Math.max(max,h[d]);
        }
        }
  
  
 	if(ans==0){
    		System.out.println("Yes");
    	}else{
     		System.out.println("No");
   	 }

    	
    }
} import java.util.*; util.* java 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 c=0;c<n;c++){
    		h[c]=sc.nextInt();
       
          }
    	
  
  		int ans=0;
  		int max=h[0];
  		
  
    for(int d=1;d<n;d++){
        if(h[d]<max-1){
            	ans++;
                break;
            }else{
        	max=Math.max(max,h[d]);
        }
        }
  
  
 	if(ans==0){
    		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[] h=new int[n];
		for(int c=0;c<n;c++){
    		h[c]=sc.nextInt();
       
          }
    	
  
  		int ans=0;
  		int max=h[0];
  		
  
    for(int d=1;d<n;d++){
        if(h[d]<max-1){
            	ans++;
                break;
            }else{
        	max=Math.max(max,h[d]);
        }
        }
  
  
 	if(ans==0){
    		System.out.println("Yes");
    	}else{
     		System.out.println("No");
   	 }

    	
    } main {
	Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
      
  		int[] h=new int[n];
		for(int c=0;c<n;c++){
    		h[c]=sc.nextInt();
       
          }
    	
  
  		int ans=0;
  		int max=h[0];
  		
  
    for(int d=1;d<n;d++){
        if(h[d]<max-1){
            	ans++;
                break;
            }else{
        	max=Math.max(max,h[d]);
        }
        }
  
  
 	if(ans==0){
    		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[] h=new int[n]; h new int[n] n for(int c=0;c<n;c++){
    		h[c]=sc.nextInt();
       
          } int c=0; int c=0; c 0 c<n c n c++ c++ c {
    		h[c]=sc.nextInt();
       
          } {
    		h[c]=sc.nextInt();
       
          } h[c]=sc.nextInt() h[c] h c sc.nextInt() sc.nextInt sc int ans=0; ans 0 int max=h[0]; max h[0] h 0 for(int d=1;d<n;d++){
        if(h[d]<max-1){
            	ans++;
                break;
            }else{
        	max=Math.max(max,h[d]);
        }
        } int d=1; int d=1; d 1 d<n d n d++ d++ d {
        if(h[d]<max-1){
            	ans++;
                break;
            }else{
        	max=Math.max(max,h[d]);
        }
        } {
        if(h[d]<max-1){
            	ans++;
                break;
            }else{
        	max=Math.max(max,h[d]);
        }
        } if(h[d]<max-1){
            	ans++;
                break;
            }else{
        	max=Math.max(max,h[d]);
        } h[d]<max-1 h[d] h d max-1 max 1 {
            	ans++;
                break;
            } ans++ ans break; {
        	max=Math.max(max,h[d]);
        } max=Math.max(max,h[d]) max Math.max(max,h[d]) Math.max Math max h[d] h d if(ans==0){
    		System.out.println("Yes");
    	}else{
     		System.out.println("No");
   	 } ans==0 ans 0 {
    		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
import java.util.*; 

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 c=0;c<n;c++){
    		h[c]=sc.nextInt();
       
          }
    	
  
  		int ans=0;
  		int max=h[0];
  		
  
    for(int d=1;d<n;d++){
        if(h[d]<max-1){
            	ans++;
                break;
            }else{
        	max=Math.max(max,h[d]);
        }
        }
  
  
 	if(ans==0){
    		System.out.println("Yes");
    	}else{
     		System.out.println("No");
   	 }

    	
    }
}