import java.util.*;
public class Main {
    public static void main(String[] args){
        Main main = new Main();
        String ans = main.solve()<0?"No":"Yes";
        System.out.println(ans);
    }
    long solve(){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] h = new int[n];
        for(int i=0;i<n; i++) h[i] = sc.nextInt();

        for(int j=n-2;j>=0;j--){
            if(h[j]<=h[j+1]) continue;
            else if(h[j]==h[j+1]+1){
                h[j] -= 1;
            } else{
                return -1;
            }
        }
        return 0;
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args){
        Main main = new Main();
        String ans = main.solve()<0?"No":"Yes";
        System.out.println(ans);
    }
    long solve(){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] h = new int[n];
        for(int i=0;i<n; i++) h[i] = sc.nextInt();

        for(int j=n-2;j>=0;j--){
            if(h[j]<=h[j+1]) continue;
            else if(h[j]==h[j+1]+1){
                h[j] -= 1;
            } else{
                return -1;
            }
        }
        return 0;
    }
} Main public static void main(String[] args){
        Main main = new Main();
        String ans = main.solve()<0?"No":"Yes";
        System.out.println(ans);
    } main {
        Main main = new Main();
        String ans = main.solve()<0?"No":"Yes";
        System.out.println(ans);
    } Main main = new Main(); main new Main() String ans = main.solve()<0?"No":"Yes"; ans main.solve()<0?"No":"Yes" main.solve()<0 main.solve() main.solve main 0 "No" "Yes" System.out.println(ans) System.out.println System.out System System.out ans String[] args args long solve(){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] h = new int[n];
        for(int i=0;i<n; i++) h[i] = sc.nextInt();

        for(int j=n-2;j>=0;j--){
            if(h[j]<=h[j+1]) continue;
            else if(h[j]==h[j+1]+1){
                h[j] -= 1;
            } else{
                return -1;
            }
        }
        return 0;
    } solve {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] h = new int[n];
        for(int i=0;i<n; i++) h[i] = sc.nextInt();

        for(int j=n-2;j>=0;j--){
            if(h[j]<=h[j+1]) continue;
            else if(h[j]==h[j+1]+1){
                h[j] -= 1;
            } else{
                return -1;
            }
        }
        return 0;
    } 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 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] h i sc.nextInt() sc.nextInt sc for(int j=n-2;j>=0;j--){
            if(h[j]<=h[j+1]) continue;
            else if(h[j]==h[j+1]+1){
                h[j] -= 1;
            } else{
                return -1;
            }
        } int j=n-2; int j=n-2; j n-2 n 2 j>=0 j 0 j-- j-- j {
            if(h[j]<=h[j+1]) continue;
            else if(h[j]==h[j+1]+1){
                h[j] -= 1;
            } else{
                return -1;
            }
        } {
            if(h[j]<=h[j+1]) continue;
            else if(h[j]==h[j+1]+1){
                h[j] -= 1;
            } else{
                return -1;
            }
        } if(h[j]<=h[j+1]) continue;
            else if(h[j]==h[j+1]+1){
                h[j] -= 1;
            } else{
                return -1;
            } h[j]<=h[j+1] h[j] h j h[j+1] h j+1 j 1 continue; if(h[j]==h[j+1]+1){
                h[j] -= 1;
            } else{
                return -1;
            } h[j]==h[j+1]+1 h[j] h j h[j+1]+1 h[j+1] h j+1 j 1 1 {
                h[j] -= 1;
            } h[j] -= 1 h[j] h j 1 {
                return -1;
            } return -1; -1 1 return 0; 0 public class Main {
    public static void main(String[] args){
        Main main = new Main();
        String ans = main.solve()<0?"No":"Yes";
        System.out.println(ans);
    }
    long solve(){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] h = new int[n];
        for(int i=0;i<n; i++) h[i] = sc.nextInt();

        for(int j=n-2;j>=0;j--){
            if(h[j]<=h[j+1]) continue;
            else if(h[j]==h[j+1]+1){
                h[j] -= 1;
            } else{
                return -1;
            }
        }
        return 0;
    }
} public class Main {
    public static void main(String[] args){
        Main main = new Main();
        String ans = main.solve()<0?"No":"Yes";
        System.out.println(ans);
    }
    long solve(){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] h = new int[n];
        for(int i=0;i<n; i++) h[i] = sc.nextInt();

        for(int j=n-2;j>=0;j--){
            if(h[j]<=h[j+1]) continue;
            else if(h[j]==h[j+1]+1){
                h[j] -= 1;
            } else{
                return -1;
            }
        }
        return 0;
    }
} Main
import java.util.*;
public class Main {
    public static void main(String[] args){
        Main main = new Main();
        String ans = main.solve()<0?"No":"Yes";
        System.out.println(ans);
    }
    long solve(){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] h = new int[n];
        for(int i=0;i<n; i++) h[i] = sc.nextInt();

        for(int j=n-2;j>=0;j--){
            if(h[j]<=h[j+1]) continue;
            else if(h[j]==h[j+1]+1){
                h[j] -= 1;
            } else{
                return -1;
            }
        }
        return 0;
    }
}
