import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.nextLine();
        String line = sc.nextLine();
        int[] h = new int[n];
        String[] ll = line.split(" ");

        for (int i = 0; i < n; i++) {
            h[i] = Integer.parseInt(ll[i]);
        }

        boolean isLiner = true;
        int max = h[0];
        for (int i = 0; i < n; i++) {
            if(max > h[i]){
                isLiner = false;
            }

            if(max < h[i] - 1){
                max = h[i] - 1;
            }

        }

        if (isLiner) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        return;
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.nextLine();
        String line = sc.nextLine();
        int[] h = new int[n];
        String[] ll = line.split(" ");

        for (int i = 0; i < n; i++) {
            h[i] = Integer.parseInt(ll[i]);
        }

        boolean isLiner = true;
        int max = h[0];
        for (int i = 0; i < n; i++) {
            if(max > h[i]){
                isLiner = false;
            }

            if(max < h[i] - 1){
                max = h[i] - 1;
            }

        }

        if (isLiner) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        return;
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.nextLine();
        String line = sc.nextLine();
        int[] h = new int[n];
        String[] ll = line.split(" ");

        for (int i = 0; i < n; i++) {
            h[i] = Integer.parseInt(ll[i]);
        }

        boolean isLiner = true;
        int max = h[0];
        for (int i = 0; i < n; i++) {
            if(max > h[i]){
                isLiner = false;
            }

            if(max < h[i] - 1){
                max = h[i] - 1;
            }

        }

        if (isLiner) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        return;
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.nextLine();
        String line = sc.nextLine();
        int[] h = new int[n];
        String[] ll = line.split(" ");

        for (int i = 0; i < n; i++) {
            h[i] = Integer.parseInt(ll[i]);
        }

        boolean isLiner = true;
        int max = h[0];
        for (int i = 0; i < n; i++) {
            if(max > h[i]){
                isLiner = false;
            }

            if(max < h[i] - 1){
                max = h[i] - 1;
            }

        }

        if (isLiner) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        return;
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc sc.nextLine() sc.nextLine sc String line = sc.nextLine(); line sc.nextLine() sc.nextLine sc int[] h = new int[n]; h new int[n] n String[] ll = line.split(" "); ll line.split(" ") line.split line " " for (int i = 0; i < n; i++) {
            h[i] = Integer.parseInt(ll[i]);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            h[i] = Integer.parseInt(ll[i]);
        } {
            h[i] = Integer.parseInt(ll[i]);
        } h[i] = Integer.parseInt(ll[i]) h[i] h i Integer.parseInt(ll[i]) Integer.parseInt Integer ll[i] ll i boolean isLiner = true; isLiner true int max = h[0]; max h[0] h 0 for (int i = 0; i < n; i++) {
            if(max > h[i]){
                isLiner = false;
            }

            if(max < h[i] - 1){
                max = h[i] - 1;
            }

        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            if(max > h[i]){
                isLiner = false;
            }

            if(max < h[i] - 1){
                max = h[i] - 1;
            }

        } {
            if(max > h[i]){
                isLiner = false;
            }

            if(max < h[i] - 1){
                max = h[i] - 1;
            }

        } if(max > h[i]){
                isLiner = false;
            } max > h[i] max h[i] h i {
                isLiner = false;
            } isLiner = false isLiner false if(max < h[i] - 1){
                max = h[i] - 1;
            } max < h[i] - 1 max h[i] - 1 h[i] h i 1 {
                max = h[i] - 1;
            } max = h[i] - 1 max h[i] - 1 h[i] h i 1 if (isLiner) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        } isLiner {
            System.out.println("Yes");
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
            System.out.println("No");
        } System.out.println("No") System.out.println System.out System System.out "No" return; String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.nextLine();
        String line = sc.nextLine();
        int[] h = new int[n];
        String[] ll = line.split(" ");

        for (int i = 0; i < n; i++) {
            h[i] = Integer.parseInt(ll[i]);
        }

        boolean isLiner = true;
        int max = h[0];
        for (int i = 0; i < n; i++) {
            if(max > h[i]){
                isLiner = false;
            }

            if(max < h[i] - 1){
                max = h[i] - 1;
            }

        }

        if (isLiner) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        return;
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.nextLine();
        String line = sc.nextLine();
        int[] h = new int[n];
        String[] ll = line.split(" ");

        for (int i = 0; i < n; i++) {
            h[i] = Integer.parseInt(ll[i]);
        }

        boolean isLiner = true;
        int max = h[0];
        for (int i = 0; i < n; i++) {
            if(max > h[i]){
                isLiner = false;
            }

            if(max < h[i] - 1){
                max = h[i] - 1;
            }

        }

        if (isLiner) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        return;
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.nextLine();
        String line = sc.nextLine();
        int[] h = new int[n];
        String[] ll = line.split(" ");

        for (int i = 0; i < n; i++) {
            h[i] = Integer.parseInt(ll[i]);
        }

        boolean isLiner = true;
        int max = h[0];
        for (int i = 0; i < n; i++) {
            if(max > h[i]){
                isLiner = false;
            }

            if(max < h[i] - 1){
                max = h[i] - 1;
            }

        }

        if (isLiner) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        return;
    }
}
