
import java.util.Scanner;
  class Main {
    public static void main(String[]args){
        Scanner scan = new Scanner(System.in) ;
        int n = scan.nextInt();
        int arr[] = new int[n+1] ;
        for(int i = 1 ; i<=n ;i++){
           arr[i] = scan.nextInt();
        }
        for(int i =1  ; i<=n ; i++){
            if(arr[i] > arr[i-1]){
               
                arr[i]--;
               
            } 
        }
        int count =  0 ; 
        for(int i = 1 ; i< n ;i++){
            if(arr[i] > arr[i+1]){
                count ++ ;
            }
        }
        if(count == 0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} import java.util.Scanner; Scanner java.util class Main {
    public static void main(String[]args){
        Scanner scan = new Scanner(System.in) ;
        int n = scan.nextInt();
        int arr[] = new int[n+1] ;
        for(int i = 1 ; i<=n ;i++){
           arr[i] = scan.nextInt();
        }
        for(int i =1  ; i<=n ; i++){
            if(arr[i] > arr[i-1]){
               
                arr[i]--;
               
            } 
        }
        int count =  0 ; 
        for(int i = 1 ; i< n ;i++){
            if(arr[i] > arr[i+1]){
                count ++ ;
            }
        }
        if(count == 0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} Main public static void main(String[]args){
        Scanner scan = new Scanner(System.in) ;
        int n = scan.nextInt();
        int arr[] = new int[n+1] ;
        for(int i = 1 ; i<=n ;i++){
           arr[i] = scan.nextInt();
        }
        for(int i =1  ; i<=n ; i++){
            if(arr[i] > arr[i-1]){
               
                arr[i]--;
               
            } 
        }
        int count =  0 ; 
        for(int i = 1 ; i< n ;i++){
            if(arr[i] > arr[i+1]){
                count ++ ;
            }
        }
        if(count == 0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } main {
        Scanner scan = new Scanner(System.in) ;
        int n = scan.nextInt();
        int arr[] = new int[n+1] ;
        for(int i = 1 ; i<=n ;i++){
           arr[i] = scan.nextInt();
        }
        for(int i =1  ; i<=n ; i++){
            if(arr[i] > arr[i-1]){
               
                arr[i]--;
               
            } 
        }
        int count =  0 ; 
        for(int i = 1 ; i< n ;i++){
            if(arr[i] > arr[i+1]){
                count ++ ;
            }
        }
        if(count == 0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } Scanner scan = new Scanner(System.in) ; scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int arr[] = new int[n+1] ; arr new int[n+1] n+1 n 1 for(int i = 1 ; i<=n ;i++){
           arr[i] = scan.nextInt();
        } int i = 1 ; int i = 1 ; i 1 i<=n i n i++ i++ i {
           arr[i] = scan.nextInt();
        } {
           arr[i] = scan.nextInt();
        } arr[i] = scan.nextInt() arr[i] arr i scan.nextInt() scan.nextInt scan for(int i =1  ; i<=n ; i++){
            if(arr[i] > arr[i-1]){
               
                arr[i]--;
               
            } 
        } int i =1  ; int i =1  ; i 1 i<=n i n i++ i++ i {
            if(arr[i] > arr[i-1]){
               
                arr[i]--;
               
            } 
        } {
            if(arr[i] > arr[i-1]){
               
                arr[i]--;
               
            } 
        } if(arr[i] > arr[i-1]){
               
                arr[i]--;
               
            } arr[i] > arr[i-1] arr[i] arr i arr[i-1] arr i-1 i 1 {
               
                arr[i]--;
               
            } arr[i]-- arr[i] arr i int count =  0 ; count 0 for(int i = 1 ; i< n ;i++){
            if(arr[i] > arr[i+1]){
                count ++ ;
            }
        } int i = 1 ; int i = 1 ; i 1 i< n i n i++ i++ i {
            if(arr[i] > arr[i+1]){
                count ++ ;
            }
        } {
            if(arr[i] > arr[i+1]){
                count ++ ;
            }
        } if(arr[i] > arr[i+1]){
                count ++ ;
            } arr[i] > arr[i+1] arr[i] arr i arr[i+1] arr i+1 i 1 {
                count ++ ;
            } count ++ count if(count == 0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        } count == 0 count 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.Scanner;
  class Main {
    public static void main(String[]args){
        Scanner scan = new Scanner(System.in) ;
        int n = scan.nextInt();
        int arr[] = new int[n+1] ;
        for(int i = 1 ; i<=n ;i++){
           arr[i] = scan.nextInt();
        }
        for(int i =1  ; i<=n ; i++){
            if(arr[i] > arr[i-1]){
               
                arr[i]--;
               
            } 
        }
        int count =  0 ; 
        for(int i = 1 ; i< n ;i++){
            if(arr[i] > arr[i+1]){
                count ++ ;
            }
        }
        if(count == 0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}
