import java.util.*;

public class Main{
    public static void main(String[] args){
    //入力
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] H = new int[N];
        int[] L = new int[N-1];
        for(int i=0; i<N; i++){
            H[i] = sc.nextInt();
        }
        for(int j=N-2;j>=0;j--){
            if(j<N-2){
                L[j] = Math.min(L[j+1],H[j+1]);
            }
            else{
                L[j] = H[j+1];
            }
        }
    //処理
        boolean b = true;
        for(int i=0;i<N-1;i++){
            if(H[i]-1>L[i]){
                b = false;
            }
        }
        System.out.println((b)?"Yes":"No");
        sc.close();

    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
    //入力
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] H = new int[N];
        int[] L = new int[N-1];
        for(int i=0; i<N; i++){
            H[i] = sc.nextInt();
        }
        for(int j=N-2;j>=0;j--){
            if(j<N-2){
                L[j] = Math.min(L[j+1],H[j+1]);
            }
            else{
                L[j] = H[j+1];
            }
        }
    //処理
        boolean b = true;
        for(int i=0;i<N-1;i++){
            if(H[i]-1>L[i]){
                b = false;
            }
        }
        System.out.println((b)?"Yes":"No");
        sc.close();

    }
} Main public static void main(String[] args){
    //入力
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] H = new int[N];
        int[] L = new int[N-1];
        for(int i=0; i<N; i++){
            H[i] = sc.nextInt();
        }
        for(int j=N-2;j>=0;j--){
            if(j<N-2){
                L[j] = Math.min(L[j+1],H[j+1]);
            }
            else{
                L[j] = H[j+1];
            }
        }
    //処理
        boolean b = true;
        for(int i=0;i<N-1;i++){
            if(H[i]-1>L[i]){
                b = false;
            }
        }
        System.out.println((b)?"Yes":"No");
        sc.close();

    } main {
    //入力
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] H = new int[N];
        int[] L = new int[N-1];
        for(int i=0; i<N; i++){
            H[i] = sc.nextInt();
        }
        for(int j=N-2;j>=0;j--){
            if(j<N-2){
                L[j] = Math.min(L[j+1],H[j+1]);
            }
            else{
                L[j] = H[j+1];
            }
        }
    //処理
        boolean b = true;
        for(int i=0;i<N-1;i++){
            if(H[i]-1>L[i]){
                b = false;
            }
        }
        System.out.println((b)?"Yes":"No");
        sc.close();

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] H = new int[N]; H new int[N] N int[] L = new int[N-1]; L new int[N-1] N-1 N 1 for(int i=0; i<N; i++){
            H[i] = sc.nextInt();
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
            H[i] = sc.nextInt();
        } {
            H[i] = sc.nextInt();
        } H[i] = sc.nextInt() H[i] H i sc.nextInt() sc.nextInt sc for(int j=N-2;j>=0;j--){
            if(j<N-2){
                L[j] = Math.min(L[j+1],H[j+1]);
            }
            else{
                L[j] = H[j+1];
            }
        } int j=N-2; int j=N-2; j N-2 N 2 j>=0 j 0 j-- j-- j {
            if(j<N-2){
                L[j] = Math.min(L[j+1],H[j+1]);
            }
            else{
                L[j] = H[j+1];
            }
        } {
            if(j<N-2){
                L[j] = Math.min(L[j+1],H[j+1]);
            }
            else{
                L[j] = H[j+1];
            }
        } if(j<N-2){
                L[j] = Math.min(L[j+1],H[j+1]);
            }
            else{
                L[j] = H[j+1];
            } j<N-2 j N-2 N 2 {
                L[j] = Math.min(L[j+1],H[j+1]);
            } L[j] = Math.min(L[j+1],H[j+1]) L[j] L j Math.min(L[j+1],H[j+1]) Math.min Math L[j+1] L j+1 j 1 H[j+1] H j+1 j 1 {
                L[j] = H[j+1];
            } L[j] = H[j+1] L[j] L j H[j+1] H j+1 j 1 boolean b = true; b true for(int i=0;i<N-1;i++){
            if(H[i]-1>L[i]){
                b = false;
            }
        } int i=0; int i=0; i 0 i<N-1 i N-1 N 1 i++ i++ i {
            if(H[i]-1>L[i]){
                b = false;
            }
        } {
            if(H[i]-1>L[i]){
                b = false;
            }
        } if(H[i]-1>L[i]){
                b = false;
            } H[i]-1>L[i] H[i]-1 H[i] H i 1 L[i] L i {
                b = false;
            } b = false b false System.out.println((b)?"Yes":"No") System.out.println System.out System System.out (b)?"Yes":"No" (b) "Yes" "No" sc.close() sc.close sc String[] args args public class Main{
    public static void main(String[] args){
    //入力
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] H = new int[N];
        int[] L = new int[N-1];
        for(int i=0; i<N; i++){
            H[i] = sc.nextInt();
        }
        for(int j=N-2;j>=0;j--){
            if(j<N-2){
                L[j] = Math.min(L[j+1],H[j+1]);
            }
            else{
                L[j] = H[j+1];
            }
        }
    //処理
        boolean b = true;
        for(int i=0;i<N-1;i++){
            if(H[i]-1>L[i]){
                b = false;
            }
        }
        System.out.println((b)?"Yes":"No");
        sc.close();

    }
} public class Main{
    public static void main(String[] args){
    //入力
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] H = new int[N];
        int[] L = new int[N-1];
        for(int i=0; i<N; i++){
            H[i] = sc.nextInt();
        }
        for(int j=N-2;j>=0;j--){
            if(j<N-2){
                L[j] = Math.min(L[j+1],H[j+1]);
            }
            else{
                L[j] = H[j+1];
            }
        }
    //処理
        boolean b = true;
        for(int i=0;i<N-1;i++){
            if(H[i]-1>L[i]){
                b = false;
            }
        }
        System.out.println((b)?"Yes":"No");
        sc.close();

    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args){
    //入力
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] H = new int[N];
        int[] L = new int[N-1];
        for(int i=0; i<N; i++){
            H[i] = sc.nextInt();
        }
        for(int j=N-2;j>=0;j--){
            if(j<N-2){
                L[j] = Math.min(L[j+1],H[j+1]);
            }
            else{
                L[j] = H[j+1];
            }
        }
    //処理
        boolean b = true;
        for(int i=0;i<N-1;i++){
            if(H[i]-1>L[i]){
                b = false;
            }
        }
        System.out.println((b)?"Yes":"No");
        sc.close();

    }
}