import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Integer[] h = new Integer[n];
        for (int i = 0; i < n; i++) {
            h[i] = sc.nextInt();
        }

        boolean result = true;
        int max = h[0];
        for (int i = 1; i < n && result; i++) {
            if (max < h[i]){
                max = h[i] - 1;
            } else if (max > h[i]) {
                result = false;
            }
        }

        System.out.println(result ? "Yes" : "No");
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Integer[] h = new Integer[n];
        for (int i = 0; i < n; i++) {
            h[i] = sc.nextInt();
        }

        boolean result = true;
        int max = h[0];
        for (int i = 1; i < n && result; i++) {
            if (max < h[i]){
                max = h[i] - 1;
            } else if (max > h[i]) {
                result = false;
            }
        }

        System.out.println(result ? "Yes" : "No");
    }
} Main public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Integer[] h = new Integer[n];
        for (int i = 0; i < n; i++) {
            h[i] = sc.nextInt();
        }

        boolean result = true;
        int max = h[0];
        for (int i = 1; i < n && result; i++) {
            if (max < h[i]){
                max = h[i] - 1;
            } else if (max > h[i]) {
                result = false;
            }
        }

        System.out.println(result ? "Yes" : "No");
    } main {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Integer[] h = new Integer[n];
        for (int i = 0; i < n; i++) {
            h[i] = sc.nextInt();
        }

        boolean result = true;
        int max = h[0];
        for (int i = 1; i < n && result; i++) {
            if (max < h[i]){
                max = h[i] - 1;
            } else if (max > h[i]) {
                result = false;
            }
        }

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

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Integer[] h = new Integer[n];
        for (int i = 0; i < n; i++) {
            h[i] = sc.nextInt();
        }

        boolean result = true;
        int max = h[0];
        for (int i = 1; i < n && result; i++) {
            if (max < h[i]){
                max = h[i] - 1;
            } else if (max > h[i]) {
                result = false;
            }
        }

        System.out.println(result ? "Yes" : "No");
    }
} public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Integer[] h = new Integer[n];
        for (int i = 0; i < n; i++) {
            h[i] = sc.nextInt();
        }

        boolean result = true;
        int max = h[0];
        for (int i = 1; i < n && result; i++) {
            if (max < h[i]){
                max = h[i] - 1;
            } else if (max > h[i]) {
                result = false;
            }
        }

        System.out.println(result ? "Yes" : "No");
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Integer[] h = new Integer[n];
        for (int i = 0; i < n; i++) {
            h[i] = sc.nextInt();
        }

        boolean result = true;
        int max = h[0];
        for (int i = 1; i < n && result; i++) {
            if (max < h[i]){
                max = h[i] - 1;
            } else if (max > h[i]) {
                result = false;
            }
        }

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