import java.util.*;
import java.io.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int N = Integer.parseInt(sc.next());
        int[] H = new int[N];
        for (int i = 0; i < N; i++) {
            H[i] = Integer.parseInt(sc.next());
        }
        sc.close();

        boolean result = true;
        for (int i = N - 2; i >= 0; i--) {
            if (H[i] <= H[i + 1]) {
                continue;
            }
            if (H[i] - 1 == H[i + 1]) {
                H[i]--;
            } else {
                result = false;
                break;
            }
        }

        if (result) {
            out.printf("Yes\n");
        } else {
            out.printf("No\n");
        }
        out.flush();
    }
} import java.util.*; util.* java import java.io.*; io.* java class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int N = Integer.parseInt(sc.next());
        int[] H = new int[N];
        for (int i = 0; i < N; i++) {
            H[i] = Integer.parseInt(sc.next());
        }
        sc.close();

        boolean result = true;
        for (int i = N - 2; i >= 0; i--) {
            if (H[i] <= H[i + 1]) {
                continue;
            }
            if (H[i] - 1 == H[i + 1]) {
                H[i]--;
            } else {
                result = false;
                break;
            }
        }

        if (result) {
            out.printf("Yes\n");
        } else {
            out.printf("No\n");
        }
        out.flush();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int N = Integer.parseInt(sc.next());
        int[] H = new int[N];
        for (int i = 0; i < N; i++) {
            H[i] = Integer.parseInt(sc.next());
        }
        sc.close();

        boolean result = true;
        for (int i = N - 2; i >= 0; i--) {
            if (H[i] <= H[i + 1]) {
                continue;
            }
            if (H[i] - 1 == H[i + 1]) {
                H[i]--;
            } else {
                result = false;
                break;
            }
        }

        if (result) {
            out.printf("Yes\n");
        } else {
            out.printf("No\n");
        }
        out.flush();
    } main {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int N = Integer.parseInt(sc.next());
        int[] H = new int[N];
        for (int i = 0; i < N; i++) {
            H[i] = Integer.parseInt(sc.next());
        }
        sc.close();

        boolean result = true;
        for (int i = N - 2; i >= 0; i--) {
            if (H[i] <= H[i + 1]) {
                continue;
            }
            if (H[i] - 1 == H[i + 1]) {
                H[i]--;
            } else {
                result = false;
                break;
            }
        }

        if (result) {
            out.printf("Yes\n");
        } else {
            out.printf("No\n");
        }
        out.flush();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) int N = Integer.parseInt(sc.next()); N Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int[] H = new int[N]; H new int[N] N for (int i = 0; i < N; i++) {
            H[i] = Integer.parseInt(sc.next());
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            H[i] = Integer.parseInt(sc.next());
        } {
            H[i] = Integer.parseInt(sc.next());
        } H[i] = Integer.parseInt(sc.next()) H[i] H i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc sc.close() sc.close sc boolean result = true; result true for (int i = N - 2; i >= 0; i--) {
            if (H[i] <= H[i + 1]) {
                continue;
            }
            if (H[i] - 1 == H[i + 1]) {
                H[i]--;
            } else {
                result = false;
                break;
            }
        } int i = N - 2; int i = N - 2; i N - 2 N 2 i >= 0 i 0 i-- i-- i {
            if (H[i] <= H[i + 1]) {
                continue;
            }
            if (H[i] - 1 == H[i + 1]) {
                H[i]--;
            } else {
                result = false;
                break;
            }
        } {
            if (H[i] <= H[i + 1]) {
                continue;
            }
            if (H[i] - 1 == H[i + 1]) {
                H[i]--;
            } else {
                result = false;
                break;
            }
        } if (H[i] <= H[i + 1]) {
                continue;
            } H[i] <= H[i + 1] H[i] H i H[i + 1] H i + 1 i 1 {
                continue;
            } continue; if (H[i] - 1 == H[i + 1]) {
                H[i]--;
            } else {
                result = false;
                break;
            } 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 {
                result = false;
                break;
            } result = false result false break; if (result) {
            out.printf("Yes\n");
        } else {
            out.printf("No\n");
        } result {
            out.printf("Yes\n");
        } out.printf("Yes\n") out.printf out "Yes\n" {
            out.printf("No\n");
        } out.printf("No\n") out.printf out "No\n" out.flush() out.flush out String[] args args
import java.util.*;
import java.io.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int N = Integer.parseInt(sc.next());
        int[] H = new int[N];
        for (int i = 0; i < N; i++) {
            H[i] = Integer.parseInt(sc.next());
        }
        sc.close();

        boolean result = true;
        for (int i = N - 2; i >= 0; i--) {
            if (H[i] <= H[i + 1]) {
                continue;
            }
            if (H[i] - 1 == H[i + 1]) {
                H[i]--;
            } else {
                result = false;
                break;
            }
        }

        if (result) {
            out.printf("Yes\n");
        } else {
            out.printf("No\n");
        }
        out.flush();
    }
}
