import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        List<Integer> val = new ArrayList<>();
        for(int i=0; i<N; i++){
            val.add(scanner.nextInt());
        }
        int minRight = val.get(N-1);
        String result = "Yes";
        for(int i=N-2; i>=0; i--){
            if(val.get(i) >= minRight+2){
                result = "No";
            }
            if(minRight>val.get(i)){
                minRight = val.get(i);
            }
        }
        System.out.println(result);
    }
} import java.util.*; util.* java public class Main{
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        List<Integer> val = new ArrayList<>();
        for(int i=0; i<N; i++){
            val.add(scanner.nextInt());
        }
        int minRight = val.get(N-1);
        String result = "Yes";
        for(int i=N-2; i>=0; i--){
            if(val.get(i) >= minRight+2){
                result = "No";
            }
            if(minRight>val.get(i)){
                minRight = val.get(i);
            }
        }
        System.out.println(result);
    }
} Main public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        List<Integer> val = new ArrayList<>();
        for(int i=0; i<N; i++){
            val.add(scanner.nextInt());
        }
        int minRight = val.get(N-1);
        String result = "Yes";
        for(int i=N-2; i>=0; i--){
            if(val.get(i) >= minRight+2){
                result = "No";
            }
            if(minRight>val.get(i)){
                minRight = val.get(i);
            }
        }
        System.out.println(result);
    } main {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        List<Integer> val = new ArrayList<>();
        for(int i=0; i<N; i++){
            val.add(scanner.nextInt());
        }
        int minRight = val.get(N-1);
        String result = "Yes";
        for(int i=N-2; i>=0; i--){
            if(val.get(i) >= minRight+2){
                result = "No";
            }
            if(minRight>val.get(i)){
                minRight = val.get(i);
            }
        }
        System.out.println(result);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner List<Integer> val = new ArrayList<>(); val new ArrayList<>() for(int i=0; i<N; i++){
            val.add(scanner.nextInt());
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
            val.add(scanner.nextInt());
        } {
            val.add(scanner.nextInt());
        } val.add(scanner.nextInt()) val.add val scanner.nextInt() scanner.nextInt scanner int minRight = val.get(N-1); minRight val.get(N-1) val.get val N-1 N 1 String result = "Yes"; result "Yes" for(int i=N-2; i>=0; i--){
            if(val.get(i) >= minRight+2){
                result = "No";
            }
            if(minRight>val.get(i)){
                minRight = val.get(i);
            }
        } int i=N-2; int i=N-2; i N-2 N 2 i>=0 i 0 i-- i-- i {
            if(val.get(i) >= minRight+2){
                result = "No";
            }
            if(minRight>val.get(i)){
                minRight = val.get(i);
            }
        } {
            if(val.get(i) >= minRight+2){
                result = "No";
            }
            if(minRight>val.get(i)){
                minRight = val.get(i);
            }
        } if(val.get(i) >= minRight+2){
                result = "No";
            } val.get(i) >= minRight+2 val.get(i) val.get val i minRight+2 minRight 2 {
                result = "No";
            } result = "No" result "No" if(minRight>val.get(i)){
                minRight = val.get(i);
            } minRight>val.get(i) minRight val.get(i) val.get val i {
                minRight = val.get(i);
            } minRight = val.get(i) minRight val.get(i) val.get val i System.out.println(result) System.out.println System.out System System.out result String args[] args public class Main{
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        List<Integer> val = new ArrayList<>();
        for(int i=0; i<N; i++){
            val.add(scanner.nextInt());
        }
        int minRight = val.get(N-1);
        String result = "Yes";
        for(int i=N-2; i>=0; i--){
            if(val.get(i) >= minRight+2){
                result = "No";
            }
            if(minRight>val.get(i)){
                minRight = val.get(i);
            }
        }
        System.out.println(result);
    }
} public class Main{
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        List<Integer> val = new ArrayList<>();
        for(int i=0; i<N; i++){
            val.add(scanner.nextInt());
        }
        int minRight = val.get(N-1);
        String result = "Yes";
        for(int i=N-2; i>=0; i--){
            if(val.get(i) >= minRight+2){
                result = "No";
            }
            if(minRight>val.get(i)){
                minRight = val.get(i);
            }
        }
        System.out.println(result);
    }
} Main
import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        List<Integer> val = new ArrayList<>();
        for(int i=0; i<N; i++){
            val.add(scanner.nextInt());
        }
        int minRight = val.get(N-1);
        String result = "Yes";
        for(int i=N-2; i>=0; i--){
            if(val.get(i) >= minRight+2){
                result = "No";
            }
            if(minRight>val.get(i)){
                minRight = val.get(i);
            }
        }
        System.out.println(result);
    }
}