import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws Exception {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
            int N = Integer.parseInt(reader.readLine());
            String[] array = reader.readLine().split(" ");
            int[] H = new int[N];
            for (int i = 0; i < N; i++) {
                H[i] = Integer.parseInt(array[i]);
            }

            boolean ret = true;

            for (int i = N - 1; i > 0; i--) {
                if (H[i] <= H[i - 1] - 2) {
                    ret = false;
                    break;
                }

                if (H[i] == H[i - 1] - 1) {
                    H[i - 1]--;
                }
            }

            System.out.println(ret ? "Yes" : "No");
        }
    }

} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

    public static void main(String[] args) throws Exception {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
            int N = Integer.parseInt(reader.readLine());
            String[] array = reader.readLine().split(" ");
            int[] H = new int[N];
            for (int i = 0; i < N; i++) {
                H[i] = Integer.parseInt(array[i]);
            }

            boolean ret = true;

            for (int i = N - 1; i > 0; i--) {
                if (H[i] <= H[i - 1] - 2) {
                    ret = false;
                    break;
                }

                if (H[i] == H[i - 1] - 1) {
                    H[i - 1]--;
                }
            }

            System.out.println(ret ? "Yes" : "No");
        }
    }

} Main public static void main(String[] args) throws Exception {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
            int N = Integer.parseInt(reader.readLine());
            String[] array = reader.readLine().split(" ");
            int[] H = new int[N];
            for (int i = 0; i < N; i++) {
                H[i] = Integer.parseInt(array[i]);
            }

            boolean ret = true;

            for (int i = N - 1; i > 0; i--) {
                if (H[i] <= H[i - 1] - 2) {
                    ret = false;
                    break;
                }

                if (H[i] == H[i - 1] - 1) {
                    H[i - 1]--;
                }
            }

            System.out.println(ret ? "Yes" : "No");
        }
    } main {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
            int N = Integer.parseInt(reader.readLine());
            String[] array = reader.readLine().split(" ");
            int[] H = new int[N];
            for (int i = 0; i < N; i++) {
                H[i] = Integer.parseInt(array[i]);
            }

            boolean ret = true;

            for (int i = N - 1; i > 0; i--) {
                if (H[i] <= H[i - 1] - 2) {
                    ret = false;
                    break;
                }

                if (H[i] == H[i - 1] - 1) {
                    H[i - 1]--;
                }
            }

            System.out.println(ret ? "Yes" : "No");
        }
    } try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
            int N = Integer.parseInt(reader.readLine());
            String[] array = reader.readLine().split(" ");
            int[] H = new int[N];
            for (int i = 0; i < N; i++) {
                H[i] = Integer.parseInt(array[i]);
            }

            boolean ret = true;

            for (int i = N - 1; i > 0; i--) {
                if (H[i] <= H[i - 1] - 2) {
                    ret = false;
                    break;
                }

                if (H[i] == H[i - 1] - 1) {
                    H[i - 1]--;
                }
            }

            System.out.println(ret ? "Yes" : "No");
        } {
            int N = Integer.parseInt(reader.readLine());
            String[] array = reader.readLine().split(" ");
            int[] H = new int[N];
            for (int i = 0; i < N; i++) {
                H[i] = Integer.parseInt(array[i]);
            }

            boolean ret = true;

            for (int i = N - 1; i > 0; i--) {
                if (H[i] <= H[i - 1] - 2) {
                    ret = false;
                    break;
                }

                if (H[i] == H[i - 1] - 1) {
                    H[i - 1]--;
                }
            }

            System.out.println(ret ? "Yes" : "No");
        } BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)) BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)) new BufferedReader(new InputStreamReader(System.in)) int N = Integer.parseInt(reader.readLine()); N Integer.parseInt(reader.readLine()) Integer.parseInt Integer reader.readLine() reader.readLine reader String[] array = reader.readLine().split(" "); array reader.readLine().split(" ") reader.readLine().split reader.readLine() reader.readLine reader " " int[] H = new int[N]; H new int[N] N for (int i = 0; i < N; i++) {
                H[i] = Integer.parseInt(array[i]);
            } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
                H[i] = Integer.parseInt(array[i]);
            } {
                H[i] = Integer.parseInt(array[i]);
            } H[i] = Integer.parseInt(array[i]) H[i] H i Integer.parseInt(array[i]) Integer.parseInt Integer array[i] array i boolean ret = true; ret true for (int i = N - 1; i > 0; i--) {
                if (H[i] <= H[i - 1] - 2) {
                    ret = false;
                    break;
                }

                if (H[i] == H[i - 1] - 1) {
                    H[i - 1]--;
                }
            } int i = N - 1; int i = N - 1; i N - 1 N 1 i > 0 i 0 i-- i-- i {
                if (H[i] <= H[i - 1] - 2) {
                    ret = false;
                    break;
                }

                if (H[i] == H[i - 1] - 1) {
                    H[i - 1]--;
                }
            } {
                if (H[i] <= H[i - 1] - 2) {
                    ret = false;
                    break;
                }

                if (H[i] == H[i - 1] - 1) {
                    H[i - 1]--;
                }
            } if (H[i] <= H[i - 1] - 2) {
                    ret = false;
                    break;
                } H[i] <= H[i - 1] - 2 H[i] H i H[i - 1] - 2 H[i - 1] H i - 1 i 1 2 {
                    ret = false;
                    break;
                } ret = false ret false break; if (H[i] == H[i - 1] - 1) {
                    H[i - 1]--;
                } H[i] == H[i - 1] - 1 H[i] H i H[i - 1] - 1 H[i - 1] H i - 1 i 1 1 {
                    H[i - 1]--;
                } H[i - 1]-- H[i - 1] H i - 1 i 1 System.out.println(ret ? "Yes" : "No") System.out.println System.out System System.out ret ? "Yes" : "No" ret "Yes" "No" String[] args args public class Main {

    public static void main(String[] args) throws Exception {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
            int N = Integer.parseInt(reader.readLine());
            String[] array = reader.readLine().split(" ");
            int[] H = new int[N];
            for (int i = 0; i < N; i++) {
                H[i] = Integer.parseInt(array[i]);
            }

            boolean ret = true;

            for (int i = N - 1; i > 0; i--) {
                if (H[i] <= H[i - 1] - 2) {
                    ret = false;
                    break;
                }

                if (H[i] == H[i - 1] - 1) {
                    H[i - 1]--;
                }
            }

            System.out.println(ret ? "Yes" : "No");
        }
    }

} public class Main {

    public static void main(String[] args) throws Exception {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
            int N = Integer.parseInt(reader.readLine());
            String[] array = reader.readLine().split(" ");
            int[] H = new int[N];
            for (int i = 0; i < N; i++) {
                H[i] = Integer.parseInt(array[i]);
            }

            boolean ret = true;

            for (int i = N - 1; i > 0; i--) {
                if (H[i] <= H[i - 1] - 2) {
                    ret = false;
                    break;
                }

                if (H[i] == H[i - 1] - 1) {
                    H[i - 1]--;
                }
            }

            System.out.println(ret ? "Yes" : "No");
        }
    }

} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws Exception {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
            int N = Integer.parseInt(reader.readLine());
            String[] array = reader.readLine().split(" ");
            int[] H = new int[N];
            for (int i = 0; i < N; i++) {
                H[i] = Integer.parseInt(array[i]);
            }

            boolean ret = true;

            for (int i = N - 1; i > 0; i--) {
                if (H[i] <= H[i - 1] - 2) {
                    ret = false;
                    break;
                }

                if (H[i] == H[i - 1] - 1) {
                    H[i - 1]--;
                }
            }

            System.out.println(ret ? "Yes" : "No");
        }
    }

}
