import java.util.*;
 
public class Main {
 
    public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] h = new long[n];
        long[] buff = new long[n];
        boolean f = true;
        for (int i = 0; i < n; i++) {
            h[i] = sc.nextLong();
            if (i>0) {
                if (h[i]<h[i-1]) {
                    long diff=h[i-1]-h[i];
                    if ( buff[i-1] !=0 || diff>1 ) f=false;
                    else buff[i]=1;
                }
                else if (h[i]==h[i-1]) buff[i]=buff[i-1];
            }
        }
        System.out.println(f ? "Yes" : "No");
    }
} import java.util.*; util.* java public class Main {
 
    public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] h = new long[n];
        long[] buff = new long[n];
        boolean f = true;
        for (int i = 0; i < n; i++) {
            h[i] = sc.nextLong();
            if (i>0) {
                if (h[i]<h[i-1]) {
                    long diff=h[i-1]-h[i];
                    if ( buff[i-1] !=0 || diff>1 ) f=false;
                    else buff[i]=1;
                }
                else if (h[i]==h[i-1]) buff[i]=buff[i-1];
            }
        }
        System.out.println(f ? "Yes" : "No");
    }
} Main public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] h = new long[n];
        long[] buff = new long[n];
        boolean f = true;
        for (int i = 0; i < n; i++) {
            h[i] = sc.nextLong();
            if (i>0) {
                if (h[i]<h[i-1]) {
                    long diff=h[i-1]-h[i];
                    if ( buff[i-1] !=0 || diff>1 ) f=false;
                    else buff[i]=1;
                }
                else if (h[i]==h[i-1]) buff[i]=buff[i-1];
            }
        }
        System.out.println(f ? "Yes" : "No");
    } main {
       Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] h = new long[n];
        long[] buff = new long[n];
        boolean f = true;
        for (int i = 0; i < n; i++) {
            h[i] = sc.nextLong();
            if (i>0) {
                if (h[i]<h[i-1]) {
                    long diff=h[i-1]-h[i];
                    if ( buff[i-1] !=0 || diff>1 ) f=false;
                    else buff[i]=1;
                }
                else if (h[i]==h[i-1]) buff[i]=buff[i-1];
            }
        }
        System.out.println(f ? "Yes" : "No");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc long[] h = new long[n]; h new long[n] n long[] buff = new long[n]; buff new long[n] n boolean f = true; f true for (int i = 0; i < n; i++) {
            h[i] = sc.nextLong();
            if (i>0) {
                if (h[i]<h[i-1]) {
                    long diff=h[i-1]-h[i];
                    if ( buff[i-1] !=0 || diff>1 ) f=false;
                    else buff[i]=1;
                }
                else if (h[i]==h[i-1]) buff[i]=buff[i-1];
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            h[i] = sc.nextLong();
            if (i>0) {
                if (h[i]<h[i-1]) {
                    long diff=h[i-1]-h[i];
                    if ( buff[i-1] !=0 || diff>1 ) f=false;
                    else buff[i]=1;
                }
                else if (h[i]==h[i-1]) buff[i]=buff[i-1];
            }
        } {
            h[i] = sc.nextLong();
            if (i>0) {
                if (h[i]<h[i-1]) {
                    long diff=h[i-1]-h[i];
                    if ( buff[i-1] !=0 || diff>1 ) f=false;
                    else buff[i]=1;
                }
                else if (h[i]==h[i-1]) buff[i]=buff[i-1];
            }
        } h[i] = sc.nextLong() h[i] h i sc.nextLong() sc.nextLong sc if (i>0) {
                if (h[i]<h[i-1]) {
                    long diff=h[i-1]-h[i];
                    if ( buff[i-1] !=0 || diff>1 ) f=false;
                    else buff[i]=1;
                }
                else if (h[i]==h[i-1]) buff[i]=buff[i-1];
            } i>0 i 0 {
                if (h[i]<h[i-1]) {
                    long diff=h[i-1]-h[i];
                    if ( buff[i-1] !=0 || diff>1 ) f=false;
                    else buff[i]=1;
                }
                else if (h[i]==h[i-1]) buff[i]=buff[i-1];
            } if (h[i]<h[i-1]) {
                    long diff=h[i-1]-h[i];
                    if ( buff[i-1] !=0 || diff>1 ) f=false;
                    else buff[i]=1;
                }
                else if (h[i]==h[i-1]) buff[i]=buff[i-1]; h[i]<h[i-1] h[i] h i h[i-1] h i-1 i 1 {
                    long diff=h[i-1]-h[i];
                    if ( buff[i-1] !=0 || diff>1 ) f=false;
                    else buff[i]=1;
                } long diff=h[i-1]-h[i]; diff h[i-1]-h[i] h[i-1] h i-1 i 1 h[i] h i if ( buff[i-1] !=0 || diff>1 ) f=false;
                    else buff[i]=1; buff[i-1] !=0 || diff>1 buff[i-1] !=0 buff[i-1] buff i-1 i 1 0 diff>1 diff 1 f=false f false buff[i]=1 buff[i] buff i 1 if (h[i]==h[i-1]) buff[i]=buff[i-1]; h[i]==h[i-1] h[i] h i h[i-1] h i-1 i 1 buff[i]=buff[i-1] buff[i] buff i buff[i-1] buff i-1 i 1 System.out.println(f ? "Yes" : "No") System.out.println System.out System System.out f ? "Yes" : "No" f "Yes" "No" String[] args args public class Main {
 
    public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] h = new long[n];
        long[] buff = new long[n];
        boolean f = true;
        for (int i = 0; i < n; i++) {
            h[i] = sc.nextLong();
            if (i>0) {
                if (h[i]<h[i-1]) {
                    long diff=h[i-1]-h[i];
                    if ( buff[i-1] !=0 || diff>1 ) f=false;
                    else buff[i]=1;
                }
                else if (h[i]==h[i-1]) buff[i]=buff[i-1];
            }
        }
        System.out.println(f ? "Yes" : "No");
    }
} public class Main {
 
    public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] h = new long[n];
        long[] buff = new long[n];
        boolean f = true;
        for (int i = 0; i < n; i++) {
            h[i] = sc.nextLong();
            if (i>0) {
                if (h[i]<h[i-1]) {
                    long diff=h[i-1]-h[i];
                    if ( buff[i-1] !=0 || diff>1 ) f=false;
                    else buff[i]=1;
                }
                else if (h[i]==h[i-1]) buff[i]=buff[i-1];
            }
        }
        System.out.println(f ? "Yes" : "No");
    }
} Main
import java.util.*;
 
public class Main {
 
    public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] h = new long[n];
        long[] buff = new long[n];
        boolean f = true;
        for (int i = 0; i < n; i++) {
            h[i] = sc.nextLong();
            if (i>0) {
                if (h[i]<h[i-1]) {
                    long diff=h[i-1]-h[i];
                    if ( buff[i-1] !=0 || diff>1 ) f=false;
                    else buff[i]=1;
                }
                else if (h[i]==h[i-1]) buff[i]=buff[i-1];
            }
        }
        System.out.println(f ? "Yes" : "No");
    }
}