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