import java.util.Scanner;

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] = sc.nextInt();
        }

        System.out.println(solve(n, h));
    }

    public static String solve(int n, int[] h) {
        int max = h[0];
        for (int i = 1; i < n; i++) {
            int current = h[i];
            if (current <= max - 2) {
                return "No";
            }

            max = Math.max(current, max);
        }
        return "Yes";
    }
}

 import java.util.Scanner; Scanner 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] = sc.nextInt();
        }

        System.out.println(solve(n, h));
    }

    public static String solve(int n, int[] h) {
        int max = h[0];
        for (int i = 1; i < n; i++) {
            int current = h[i];
            if (current <= max - 2) {
                return "No";
            }

            max = Math.max(current, max);
        }
        return "Yes";
    }
} 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] = sc.nextInt();
        }

        System.out.println(solve(n, h));
    } 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] = sc.nextInt();
        }

        System.out.println(solve(n, h));
    } 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] = 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 System.out.println(solve(n, h)) System.out.println System.out System System.out solve(n, h) solve n h String[] args args public static String solve(int n, int[] h) {
        int max = h[0];
        for (int i = 1; i < n; i++) {
            int current = h[i];
            if (current <= max - 2) {
                return "No";
            }

            max = Math.max(current, max);
        }
        return "Yes";
    } solve {
        int max = h[0];
        for (int i = 1; i < n; i++) {
            int current = h[i];
            if (current <= max - 2) {
                return "No";
            }

            max = Math.max(current, max);
        }
        return "Yes";
    } int max = h[0]; max h[0] h 0 for (int i = 1; i < n; i++) {
            int current = h[i];
            if (current <= max - 2) {
                return "No";
            }

            max = Math.max(current, max);
        } int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
            int current = h[i];
            if (current <= max - 2) {
                return "No";
            }

            max = Math.max(current, max);
        } {
            int current = h[i];
            if (current <= max - 2) {
                return "No";
            }

            max = Math.max(current, max);
        } int current = h[i]; current h[i] h i if (current <= max - 2) {
                return "No";
            } current <= max - 2 current max - 2 max 2 {
                return "No";
            } return "No"; "No" max = Math.max(current, max) max Math.max(current, max) Math.max Math current max return "Yes"; "Yes" int n n int[] h h 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] = sc.nextInt();
        }

        System.out.println(solve(n, h));
    }

    public static String solve(int n, int[] h) {
        int max = h[0];
        for (int i = 1; i < n; i++) {
            int current = h[i];
            if (current <= max - 2) {
                return "No";
            }

            max = Math.max(current, max);
        }
        return "Yes";
    }
} 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] = sc.nextInt();
        }

        System.out.println(solve(n, h));
    }

    public static String solve(int n, int[] h) {
        int max = h[0];
        for (int i = 1; i < n; i++) {
            int current = h[i];
            if (current <= max - 2) {
                return "No";
            }

            max = Math.max(current, max);
        }
        return "Yes";
    }
} Main
import java.util.Scanner;

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] = sc.nextInt();
        }

        System.out.println(solve(n, h));
    }

    public static String solve(int n, int[] h) {
        int max = h[0];
        for (int i = 1; i < n; i++) {
            int current = h[i];
            if (current <= max - 2) {
                return "No";
            }

            max = Math.max(current, max);
        }
        return "Yes";
    }
}


