import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] h = new int[n];
        for (int i = 0; i < n; i++) {
            h[i] = Integer.parseInt(sc.next());
        }

        // 主処理
        boolean judge = true;
        if (1 < n) {
            for (int i = 0; i < h.length - 1; i++) {
                if (h[i + 0] <= h[i + 1] - 1) {
                    h[i + 1] -= 1;
                } else if (h[i + 0] != h[i + 1]) {
                    judge = false;
                    break;
                }
            }
        }
        String result = judge ? "Yes" : "No";

        // 出力
        System.out.println(result);
        sc.close();
    }
} import java.util.*; util.* java public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] h = new int[n];
        for (int i = 0; i < n; i++) {
            h[i] = Integer.parseInt(sc.next());
        }

        // 主処理
        boolean judge = true;
        if (1 < n) {
            for (int i = 0; i < h.length - 1; i++) {
                if (h[i + 0] <= h[i + 1] - 1) {
                    h[i + 1] -= 1;
                } else if (h[i + 0] != h[i + 1]) {
                    judge = false;
                    break;
                }
            }
        }
        String result = judge ? "Yes" : "No";

        // 出力
        System.out.println(result);
        sc.close();
    }
} Main public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] h = new int[n];
        for (int i = 0; i < n; i++) {
            h[i] = Integer.parseInt(sc.next());
        }

        // 主処理
        boolean judge = true;
        if (1 < n) {
            for (int i = 0; i < h.length - 1; i++) {
                if (h[i + 0] <= h[i + 1] - 1) {
                    h[i + 1] -= 1;
                } else if (h[i + 0] != h[i + 1]) {
                    judge = false;
                    break;
                }
            }
        }
        String result = judge ? "Yes" : "No";

        // 出力
        System.out.println(result);
        sc.close();
    } main {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] h = new int[n];
        for (int i = 0; i < n; i++) {
            h[i] = Integer.parseInt(sc.next());
        }

        // 主処理
        boolean judge = true;
        if (1 < n) {
            for (int i = 0; i < h.length - 1; i++) {
                if (h[i + 0] <= h[i + 1] - 1) {
                    h[i + 1] -= 1;
                } else if (h[i + 0] != h[i + 1]) {
                    judge = false;
                    break;
                }
            }
        }
        String result = judge ? "Yes" : "No";

        // 出力
        System.out.println(result);
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) 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 boolean judge = true; judge true if (1 < n) {
            for (int i = 0; i < h.length - 1; i++) {
                if (h[i + 0] <= h[i + 1] - 1) {
                    h[i + 1] -= 1;
                } else if (h[i + 0] != h[i + 1]) {
                    judge = false;
                    break;
                }
            }
        } 1 < n 1 n {
            for (int i = 0; i < h.length - 1; i++) {
                if (h[i + 0] <= h[i + 1] - 1) {
                    h[i + 1] -= 1;
                } else if (h[i + 0] != h[i + 1]) {
                    judge = false;
                    break;
                }
            }
        } for (int i = 0; i < h.length - 1; i++) {
                if (h[i + 0] <= h[i + 1] - 1) {
                    h[i + 1] -= 1;
                } else if (h[i + 0] != h[i + 1]) {
                    judge = false;
                    break;
                }
            } int i = 0; int i = 0; i 0 i < h.length - 1 i h.length - 1 h.length h h.length 1 i++ i++ i {
                if (h[i + 0] <= h[i + 1] - 1) {
                    h[i + 1] -= 1;
                } else if (h[i + 0] != h[i + 1]) {
                    judge = false;
                    break;
                }
            } {
                if (h[i + 0] <= h[i + 1] - 1) {
                    h[i + 1] -= 1;
                } else if (h[i + 0] != h[i + 1]) {
                    judge = false;
                    break;
                }
            } if (h[i + 0] <= h[i + 1] - 1) {
                    h[i + 1] -= 1;
                } else if (h[i + 0] != h[i + 1]) {
                    judge = false;
                    break;
                } h[i + 0] <= h[i + 1] - 1 h[i + 0] h i + 0 i 0 h[i + 1] - 1 h[i + 1] h i + 1 i 1 1 {
                    h[i + 1] -= 1;
                } h[i + 1] -= 1 h[i + 1] h i + 1 i 1 1 if (h[i + 0] != h[i + 1]) {
                    judge = false;
                    break;
                } h[i + 0] != h[i + 1] h[i + 0] h i + 0 i 0 h[i + 1] h i + 1 i 1 {
                    judge = false;
                    break;
                } judge = false judge false break; String result = judge ? "Yes" : "No"; result judge ? "Yes" : "No" judge "Yes" "No" System.out.println(result) System.out.println System.out System System.out result sc.close() sc.close sc String args[] args public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] h = new int[n];
        for (int i = 0; i < n; i++) {
            h[i] = Integer.parseInt(sc.next());
        }

        // 主処理
        boolean judge = true;
        if (1 < n) {
            for (int i = 0; i < h.length - 1; i++) {
                if (h[i + 0] <= h[i + 1] - 1) {
                    h[i + 1] -= 1;
                } else if (h[i + 0] != h[i + 1]) {
                    judge = false;
                    break;
                }
            }
        }
        String result = judge ? "Yes" : "No";

        // 出力
        System.out.println(result);
        sc.close();
    }
} public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] h = new int[n];
        for (int i = 0; i < n; i++) {
            h[i] = Integer.parseInt(sc.next());
        }

        // 主処理
        boolean judge = true;
        if (1 < n) {
            for (int i = 0; i < h.length - 1; i++) {
                if (h[i + 0] <= h[i + 1] - 1) {
                    h[i + 1] -= 1;
                } else if (h[i + 0] != h[i + 1]) {
                    judge = false;
                    break;
                }
            }
        }
        String result = judge ? "Yes" : "No";

        // 出力
        System.out.println(result);
        sc.close();
    }
} Main
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] h = new int[n];
        for (int i = 0; i < n; i++) {
            h[i] = Integer.parseInt(sc.next());
        }

        // 主処理
        boolean judge = true;
        if (1 < n) {
            for (int i = 0; i < h.length - 1; i++) {
                if (h[i + 0] <= h[i + 1] - 1) {
                    h[i + 1] -= 1;
                } else if (h[i + 0] != h[i + 1]) {
                    judge = false;
                    break;
                }
            }
        }
        String result = judge ? "Yes" : "No";

        // 出力
        System.out.println(result);
        sc.close();
    }
}
