import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int n = Integer.parseInt(in.nextLine());
        String[] params = in.nextLine().split(" ");
        int[] hs = new int[n];
        for( int i = 0 ; i < n ; i++ ){
            hs[i] = Integer.parseInt( params[i]);
        }

        boolean flag = true;
        for( int i = 0 ; i < n - 1 ; i++ ){
            int prev = i == 0 ? 0 : hs[i-1];
            if( prev < hs[i]){
                hs[i] -= 1;
            }
            if( hs[i] > hs[i + 1 ]){
                flag = false;
                break;
            }
        }

        System.out.println( flag ? "Yes" : "No" );

    }

} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int n = Integer.parseInt(in.nextLine());
        String[] params = in.nextLine().split(" ");
        int[] hs = new int[n];
        for( int i = 0 ; i < n ; i++ ){
            hs[i] = Integer.parseInt( params[i]);
        }

        boolean flag = true;
        for( int i = 0 ; i < n - 1 ; i++ ){
            int prev = i == 0 ? 0 : hs[i-1];
            if( prev < hs[i]){
                hs[i] -= 1;
            }
            if( hs[i] > hs[i + 1 ]){
                flag = false;
                break;
            }
        }

        System.out.println( flag ? "Yes" : "No" );

    }

} Main public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int n = Integer.parseInt(in.nextLine());
        String[] params = in.nextLine().split(" ");
        int[] hs = new int[n];
        for( int i = 0 ; i < n ; i++ ){
            hs[i] = Integer.parseInt( params[i]);
        }

        boolean flag = true;
        for( int i = 0 ; i < n - 1 ; i++ ){
            int prev = i == 0 ? 0 : hs[i-1];
            if( prev < hs[i]){
                hs[i] -= 1;
            }
            if( hs[i] > hs[i + 1 ]){
                flag = false;
                break;
            }
        }

        System.out.println( flag ? "Yes" : "No" );

    } main {

        Scanner in = new Scanner(System.in);
        int n = Integer.parseInt(in.nextLine());
        String[] params = in.nextLine().split(" ");
        int[] hs = new int[n];
        for( int i = 0 ; i < n ; i++ ){
            hs[i] = Integer.parseInt( params[i]);
        }

        boolean flag = true;
        for( int i = 0 ; i < n - 1 ; i++ ){
            int prev = i == 0 ? 0 : hs[i-1];
            if( prev < hs[i]){
                hs[i] -= 1;
            }
            if( hs[i] > hs[i + 1 ]){
                flag = false;
                break;
            }
        }

        System.out.println( flag ? "Yes" : "No" );

    } Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = Integer.parseInt(in.nextLine()); n Integer.parseInt(in.nextLine()) Integer.parseInt Integer in.nextLine() in.nextLine in String[] params = in.nextLine().split(" "); params in.nextLine().split(" ") in.nextLine().split in.nextLine() in.nextLine in " " int[] hs = new int[n]; hs new int[n] n for( int i = 0 ; i < n ; i++ ){
            hs[i] = Integer.parseInt( params[i]);
        } int i = 0 ; int i = 0 ; i 0 i < n i n i++ i++ i {
            hs[i] = Integer.parseInt( params[i]);
        } {
            hs[i] = Integer.parseInt( params[i]);
        } hs[i] = Integer.parseInt( params[i]) hs[i] hs i Integer.parseInt( params[i]) Integer.parseInt Integer params[i] params i boolean flag = true; flag true for( int i = 0 ; i < n - 1 ; i++ ){
            int prev = i == 0 ? 0 : hs[i-1];
            if( prev < hs[i]){
                hs[i] -= 1;
            }
            if( hs[i] > hs[i + 1 ]){
                flag = false;
                break;
            }
        } int i = 0 ; int i = 0 ; i 0 i < n - 1 i n - 1 n 1 i++ i++ i {
            int prev = i == 0 ? 0 : hs[i-1];
            if( prev < hs[i]){
                hs[i] -= 1;
            }
            if( hs[i] > hs[i + 1 ]){
                flag = false;
                break;
            }
        } {
            int prev = i == 0 ? 0 : hs[i-1];
            if( prev < hs[i]){
                hs[i] -= 1;
            }
            if( hs[i] > hs[i + 1 ]){
                flag = false;
                break;
            }
        } int prev = i == 0 ? 0 : hs[i-1]; prev i == 0 ? 0 : hs[i-1] i == 0 i 0 0 hs[i-1] hs i-1 i 1 if( prev < hs[i]){
                hs[i] -= 1;
            } prev < hs[i] prev hs[i] hs i {
                hs[i] -= 1;
            } hs[i] -= 1 hs[i] hs i 1 if( hs[i] > hs[i + 1 ]){
                flag = false;
                break;
            } hs[i] > hs[i + 1 ] hs[i] hs i hs[i + 1 ] hs i + 1 i 1 {
                flag = false;
                break;
            } flag = false flag false break; System.out.println( flag ? "Yes" : "No" ) System.out.println System.out System System.out flag ? "Yes" : "No" flag "Yes" "No" String[] args args public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int n = Integer.parseInt(in.nextLine());
        String[] params = in.nextLine().split(" ");
        int[] hs = new int[n];
        for( int i = 0 ; i < n ; i++ ){
            hs[i] = Integer.parseInt( params[i]);
        }

        boolean flag = true;
        for( int i = 0 ; i < n - 1 ; i++ ){
            int prev = i == 0 ? 0 : hs[i-1];
            if( prev < hs[i]){
                hs[i] -= 1;
            }
            if( hs[i] > hs[i + 1 ]){
                flag = false;
                break;
            }
        }

        System.out.println( flag ? "Yes" : "No" );

    }

} public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int n = Integer.parseInt(in.nextLine());
        String[] params = in.nextLine().split(" ");
        int[] hs = new int[n];
        for( int i = 0 ; i < n ; i++ ){
            hs[i] = Integer.parseInt( params[i]);
        }

        boolean flag = true;
        for( int i = 0 ; i < n - 1 ; i++ ){
            int prev = i == 0 ? 0 : hs[i-1];
            if( prev < hs[i]){
                hs[i] -= 1;
            }
            if( hs[i] > hs[i + 1 ]){
                flag = false;
                break;
            }
        }

        System.out.println( flag ? "Yes" : "No" );

    }

} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int n = Integer.parseInt(in.nextLine());
        String[] params = in.nextLine().split(" ");
        int[] hs = new int[n];
        for( int i = 0 ; i < n ; i++ ){
            hs[i] = Integer.parseInt( params[i]);
        }

        boolean flag = true;
        for( int i = 0 ; i < n - 1 ; i++ ){
            int prev = i == 0 ? 0 : hs[i-1];
            if( prev < hs[i]){
                hs[i] -= 1;
            }
            if( hs[i] > hs[i + 1 ]){
                flag = false;
                break;
            }
        }

        System.out.println( flag ? "Yes" : "No" );

    }

}
