import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	    // input N H1 H2 ... HN
        Scanner sc = new Scanner(System.in);
        int numNum = sc.nextInt();
        int tempNum = 0;
        int tempMax = sc.nextInt();
        String result = "Yes";
        for(int i = 1; i < numNum; i++){
            tempNum = sc.nextInt();
            if(tempNum < tempMax - 1){
                result = "No";
                break;
            } else if(tempMax < tempNum){
                tempMax = tempNum;
            }
        }
        System.out.println(result);
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
	    // input N H1 H2 ... HN
        Scanner sc = new Scanner(System.in);
        int numNum = sc.nextInt();
        int tempNum = 0;
        int tempMax = sc.nextInt();
        String result = "Yes";
        for(int i = 1; i < numNum; i++){
            tempNum = sc.nextInt();
            if(tempNum < tempMax - 1){
                result = "No";
                break;
            } else if(tempMax < tempNum){
                tempMax = tempNum;
            }
        }
        System.out.println(result);
    }
} Main public static void main(String[] args) {
	    // input N H1 H2 ... HN
        Scanner sc = new Scanner(System.in);
        int numNum = sc.nextInt();
        int tempNum = 0;
        int tempMax = sc.nextInt();
        String result = "Yes";
        for(int i = 1; i < numNum; i++){
            tempNum = sc.nextInt();
            if(tempNum < tempMax - 1){
                result = "No";
                break;
            } else if(tempMax < tempNum){
                tempMax = tempNum;
            }
        }
        System.out.println(result);
    } main {
	    // input N H1 H2 ... HN
        Scanner sc = new Scanner(System.in);
        int numNum = sc.nextInt();
        int tempNum = 0;
        int tempMax = sc.nextInt();
        String result = "Yes";
        for(int i = 1; i < numNum; i++){
            tempNum = sc.nextInt();
            if(tempNum < tempMax - 1){
                result = "No";
                break;
            } else if(tempMax < tempNum){
                tempMax = tempNum;
            }
        }
        System.out.println(result);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int numNum = sc.nextInt(); numNum sc.nextInt() sc.nextInt sc int tempNum = 0; tempNum 0 int tempMax = sc.nextInt(); tempMax sc.nextInt() sc.nextInt sc String result = "Yes"; result "Yes" for(int i = 1; i < numNum; i++){
            tempNum = sc.nextInt();
            if(tempNum < tempMax - 1){
                result = "No";
                break;
            } else if(tempMax < tempNum){
                tempMax = tempNum;
            }
        } int i = 1; int i = 1; i 1 i < numNum i numNum i++ i++ i {
            tempNum = sc.nextInt();
            if(tempNum < tempMax - 1){
                result = "No";
                break;
            } else if(tempMax < tempNum){
                tempMax = tempNum;
            }
        } {
            tempNum = sc.nextInt();
            if(tempNum < tempMax - 1){
                result = "No";
                break;
            } else if(tempMax < tempNum){
                tempMax = tempNum;
            }
        } tempNum = sc.nextInt() tempNum sc.nextInt() sc.nextInt sc if(tempNum < tempMax - 1){
                result = "No";
                break;
            } else if(tempMax < tempNum){
                tempMax = tempNum;
            } tempNum < tempMax - 1 tempNum tempMax - 1 tempMax 1 {
                result = "No";
                break;
            } result = "No" result "No" break; if(tempMax < tempNum){
                tempMax = tempNum;
            } tempMax < tempNum tempMax tempNum {
                tempMax = tempNum;
            } tempMax = tempNum tempMax tempNum 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) {
	    // input N H1 H2 ... HN
        Scanner sc = new Scanner(System.in);
        int numNum = sc.nextInt();
        int tempNum = 0;
        int tempMax = sc.nextInt();
        String result = "Yes";
        for(int i = 1; i < numNum; i++){
            tempNum = sc.nextInt();
            if(tempNum < tempMax - 1){
                result = "No";
                break;
            } else if(tempMax < tempNum){
                tempMax = tempNum;
            }
        }
        System.out.println(result);
    }
} public class Main {

    public static void main(String[] args) {
	    // input N H1 H2 ... HN
        Scanner sc = new Scanner(System.in);
        int numNum = sc.nextInt();
        int tempNum = 0;
        int tempMax = sc.nextInt();
        String result = "Yes";
        for(int i = 1; i < numNum; i++){
            tempNum = sc.nextInt();
            if(tempNum < tempMax - 1){
                result = "No";
                break;
            } else if(tempMax < tempNum){
                tempMax = tempNum;
            }
        }
        System.out.println(result);
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	    // input N H1 H2 ... HN
        Scanner sc = new Scanner(System.in);
        int numNum = sc.nextInt();
        int tempNum = 0;
        int tempMax = sc.nextInt();
        String result = "Yes";
        for(int i = 1; i < numNum; i++){
            tempNum = sc.nextInt();
            if(tempNum < tempMax - 1){
                result = "No";
                break;
            } else if(tempMax < tempNum){
                tempMax = tempNum;
            }
        }
        System.out.println(result);
    }
}
