import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int[] H = new int[N];
            for (int i = 0; i < N; i++) {
                H[i] = in.nextInt();
            }

            for (int i = N - 2; i >= 0; i--) {
                if (H[i] <= H[i + 1]) {
                    continue;
                } else if (H[i] - 1 <= H[i + 1]) {
                    H[i]--;
                    continue;
                } else {
                    System.out.println("No");
                    return;
                }
            }
            System.out.println("Yes");
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int[] H = new int[N];
            for (int i = 0; i < N; i++) {
                H[i] = in.nextInt();
            }

            for (int i = N - 2; i >= 0; i--) {
                if (H[i] <= H[i + 1]) {
                    continue;
                } else if (H[i] - 1 <= H[i + 1]) {
                    H[i]--;
                    continue;
                } else {
                    System.out.println("No");
                    return;
                }
            }
            System.out.println("Yes");
        }
    }
} Main public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int[] H = new int[N];
            for (int i = 0; i < N; i++) {
                H[i] = in.nextInt();
            }

            for (int i = N - 2; i >= 0; i--) {
                if (H[i] <= H[i + 1]) {
                    continue;
                } else if (H[i] - 1 <= H[i + 1]) {
                    H[i]--;
                    continue;
                } else {
                    System.out.println("No");
                    return;
                }
            }
            System.out.println("Yes");
        }
    } main {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int[] H = new int[N];
            for (int i = 0; i < N; i++) {
                H[i] = in.nextInt();
            }

            for (int i = N - 2; i >= 0; i--) {
                if (H[i] <= H[i + 1]) {
                    continue;
                } else if (H[i] - 1 <= H[i + 1]) {
                    H[i]--;
                    continue;
                } else {
                    System.out.println("No");
                    return;
                }
            }
            System.out.println("Yes");
        }
    } try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int[] H = new int[N];
            for (int i = 0; i < N; i++) {
                H[i] = in.nextInt();
            }

            for (int i = N - 2; i >= 0; i--) {
                if (H[i] <= H[i + 1]) {
                    continue;
                } else if (H[i] - 1 <= H[i + 1]) {
                    H[i]--;
                    continue;
                } else {
                    System.out.println("No");
                    return;
                }
            }
            System.out.println("Yes");
        } {
            int N = in.nextInt();
            int[] H = new int[N];
            for (int i = 0; i < N; i++) {
                H[i] = in.nextInt();
            }

            for (int i = N - 2; i >= 0; i--) {
                if (H[i] <= H[i + 1]) {
                    continue;
                } else if (H[i] - 1 <= H[i + 1]) {
                    H[i]--;
                    continue;
                } else {
                    System.out.println("No");
                    return;
                }
            }
            System.out.println("Yes");
        } Scanner in = new Scanner(System.in) Scanner in = new Scanner(System.in) new Scanner(System.in) int N = in.nextInt(); N in.nextInt() in.nextInt in int[] H = new int[N]; H new int[N] N for (int i = 0; i < N; i++) {
                H[i] = in.nextInt();
            } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
                H[i] = in.nextInt();
            } {
                H[i] = in.nextInt();
            } H[i] = in.nextInt() H[i] H i in.nextInt() in.nextInt in for (int i = N - 2; i >= 0; i--) {
                if (H[i] <= H[i + 1]) {
                    continue;
                } else if (H[i] - 1 <= H[i + 1]) {
                    H[i]--;
                    continue;
                } else {
                    System.out.println("No");
                    return;
                }
            } 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;
                } else if (H[i] - 1 <= H[i + 1]) {
                    H[i]--;
                    continue;
                } else {
                    System.out.println("No");
                    return;
                }
            } {
                if (H[i] <= H[i + 1]) {
                    continue;
                } else if (H[i] - 1 <= H[i + 1]) {
                    H[i]--;
                    continue;
                } else {
                    System.out.println("No");
                    return;
                }
            } if (H[i] <= H[i + 1]) {
                    continue;
                } else if (H[i] - 1 <= H[i + 1]) {
                    H[i]--;
                    continue;
                } else {
                    System.out.println("No");
                    return;
                } 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]--;
                    continue;
                } else {
                    System.out.println("No");
                    return;
                } H[i] - 1 <= H[i + 1] H[i] - 1 H[i] H i 1 H[i + 1] H i + 1 i 1 {
                    H[i]--;
                    continue;
                } H[i]-- H[i] H i continue; {
                    System.out.println("No");
                    return;
                } System.out.println("No") System.out.println System.out System System.out "No" return; System.out.println("Yes") System.out.println System.out System System.out "Yes" String[] args args public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int[] H = new int[N];
            for (int i = 0; i < N; i++) {
                H[i] = in.nextInt();
            }

            for (int i = N - 2; i >= 0; i--) {
                if (H[i] <= H[i + 1]) {
                    continue;
                } else if (H[i] - 1 <= H[i + 1]) {
                    H[i]--;
                    continue;
                } else {
                    System.out.println("No");
                    return;
                }
            }
            System.out.println("Yes");
        }
    }
} public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int[] H = new int[N];
            for (int i = 0; i < N; i++) {
                H[i] = in.nextInt();
            }

            for (int i = N - 2; i >= 0; i--) {
                if (H[i] <= H[i + 1]) {
                    continue;
                } else if (H[i] - 1 <= H[i + 1]) {
                    H[i]--;
                    continue;
                } else {
                    System.out.println("No");
                    return;
                }
            }
            System.out.println("Yes");
        }
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int[] H = new int[N];
            for (int i = 0; i < N; i++) {
                H[i] = in.nextInt();
            }

            for (int i = N - 2; i >= 0; i--) {
                if (H[i] <= H[i + 1]) {
                    continue;
                } else if (H[i] - 1 <= H[i + 1]) {
                    H[i]--;
                    continue;
                } else {
                    System.out.println("No");
                    return;
                }
            }
            System.out.println("Yes");
        }
    }
}
