import java.util.*;

public class Main {

    long INF = Long.MAX_VALUE;
    long[] dp;
    long n;
    long S;

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] H = new long[N];
        for(int i= 0;i<N;i++){
            H[i] = sc.nextInt();
        }
        boolean ans = true;
        for(int i = N-2;i >= 0;i--){
            if(H[i]-1 == H[i+1]){
                H[i]--;
            }else if(H[i+1]-H[i] < -1 ){
                ans = false;
            }
        }
        System.out.println(ans?"Yes":"No");
    }

    int gcd(int m, int n
    ) {
        if (m < n) {
            return gcd(n, m);
        }
        if (n == 0) {
            return m;
        }
        return gcd(n, m % n);
    }
} import java.util.*; util.* java public class Main {

    long INF = Long.MAX_VALUE;
    long[] dp;
    long n;
    long S;

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] H = new long[N];
        for(int i= 0;i<N;i++){
            H[i] = sc.nextInt();
        }
        boolean ans = true;
        for(int i = N-2;i >= 0;i--){
            if(H[i]-1 == H[i+1]){
                H[i]--;
            }else if(H[i+1]-H[i] < -1 ){
                ans = false;
            }
        }
        System.out.println(ans?"Yes":"No");
    }

    int gcd(int m, int n
    ) {
        if (m < n) {
            return gcd(n, m);
        }
        if (n == 0) {
            return m;
        }
        return gcd(n, m % n);
    }
} Main long INF = Long.MAX_VALUE; INF Long.MAX_VALUE Long Long.MAX_VALUE long[] dp; dp long n; n long S; S public static void main(String[] args) {
        new Main().solve();
    } main {
        new Main().solve();
    } new Main().solve() new Main().solve new Main() String[] args args void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] H = new long[N];
        for(int i= 0;i<N;i++){
            H[i] = sc.nextInt();
        }
        boolean ans = true;
        for(int i = N-2;i >= 0;i--){
            if(H[i]-1 == H[i+1]){
                H[i]--;
            }else if(H[i+1]-H[i] < -1 ){
                ans = false;
            }
        }
        System.out.println(ans?"Yes":"No");
    } solve {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] H = new long[N];
        for(int i= 0;i<N;i++){
            H[i] = sc.nextInt();
        }
        boolean ans = true;
        for(int i = N-2;i >= 0;i--){
            if(H[i]-1 == H[i+1]){
                H[i]--;
            }else if(H[i+1]-H[i] < -1 ){
                ans = false;
            }
        }
        System.out.println(ans?"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 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 boolean ans = true; ans true for(int i = N-2;i >= 0;i--){
            if(H[i]-1 == H[i+1]){
                H[i]--;
            }else if(H[i+1]-H[i] < -1 ){
                ans = false;
            }
        } int i = N-2; int i = N-2; i N-2 N 2 i >= 0 i 0 i-- i-- i {
            if(H[i]-1 == H[i+1]){
                H[i]--;
            }else if(H[i+1]-H[i] < -1 ){
                ans = false;
            }
        } {
            if(H[i]-1 == H[i+1]){
                H[i]--;
            }else if(H[i+1]-H[i] < -1 ){
                ans = false;
            }
        } if(H[i]-1 == H[i+1]){
                H[i]--;
            }else if(H[i+1]-H[i] < -1 ){
                ans = false;
            } H[i]-1 == H[i+1] H[i]-1 H[i] H i 1 H[i+1] H i+1 i 1 {
                H[i]--;
            } H[i]-- H[i] H i if(H[i+1]-H[i] < -1 ){
                ans = false;
            } H[i+1]-H[i] < -1 H[i+1]-H[i] H[i+1] H i+1 i 1 H[i] H i -1 1 {
                ans = false;
            } ans = false ans false System.out.println(ans?"Yes":"No") System.out.println System.out System System.out ans?"Yes":"No" ans "Yes" "No" int gcd(int m, int n
    ) {
        if (m < n) {
            return gcd(n, m);
        }
        if (n == 0) {
            return m;
        }
        return gcd(n, m % n);
    } gcd {
        if (m < n) {
            return gcd(n, m);
        }
        if (n == 0) {
            return m;
        }
        return gcd(n, m % n);
    } if (m < n) {
            return gcd(n, m);
        } m < n m n {
            return gcd(n, m);
        } return gcd(n, m); gcd(n, m) gcd n m if (n == 0) {
            return m;
        } n == 0 n 0 {
            return m;
        } return m; m return gcd(n, m % n); gcd(n, m % n) gcd n m % n m n int m m int n n public class Main {

    long INF = Long.MAX_VALUE;
    long[] dp;
    long n;
    long S;

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] H = new long[N];
        for(int i= 0;i<N;i++){
            H[i] = sc.nextInt();
        }
        boolean ans = true;
        for(int i = N-2;i >= 0;i--){
            if(H[i]-1 == H[i+1]){
                H[i]--;
            }else if(H[i+1]-H[i] < -1 ){
                ans = false;
            }
        }
        System.out.println(ans?"Yes":"No");
    }

    int gcd(int m, int n
    ) {
        if (m < n) {
            return gcd(n, m);
        }
        if (n == 0) {
            return m;
        }
        return gcd(n, m % n);
    }
} public class Main {

    long INF = Long.MAX_VALUE;
    long[] dp;
    long n;
    long S;

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] H = new long[N];
        for(int i= 0;i<N;i++){
            H[i] = sc.nextInt();
        }
        boolean ans = true;
        for(int i = N-2;i >= 0;i--){
            if(H[i]-1 == H[i+1]){
                H[i]--;
            }else if(H[i+1]-H[i] < -1 ){
                ans = false;
            }
        }
        System.out.println(ans?"Yes":"No");
    }

    int gcd(int m, int n
    ) {
        if (m < n) {
            return gcd(n, m);
        }
        if (n == 0) {
            return m;
        }
        return gcd(n, m % n);
    }
} Main
import java.util.*;

public class Main {

    long INF = Long.MAX_VALUE;
    long[] dp;
    long n;
    long S;

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] H = new long[N];
        for(int i= 0;i<N;i++){
            H[i] = sc.nextInt();
        }
        boolean ans = true;
        for(int i = N-2;i >= 0;i--){
            if(H[i]-1 == H[i+1]){
                H[i]--;
            }else if(H[i+1]-H[i] < -1 ){
                ans = false;
            }
        }
        System.out.println(ans?"Yes":"No");
    }

    int gcd(int m, int n
    ) {
        if (m < n) {
            return gcd(n, m);
        }
        if (n == 0) {
            return m;
        }
        return gcd(n, m % n);
    }
}
