import java.util.Scanner;

public class Main {
    public static boolean debug = true;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] input = new int[n];
        for(int i=0;i<n;i++){
            input[i] = sc.nextInt();
        }

        int temp = 1000000001;
        for(int i=n-1;i>-1;i--){
            int now = input[i];
            //System.out.println("temp=" + temp + " now=" + now);
            if(temp >= now){
                temp = now;
                continue;
            }else if (temp >= now-1){
                temp = now-1;
                continue;
            }else{
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");



    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static boolean debug = true;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] input = new int[n];
        for(int i=0;i<n;i++){
            input[i] = sc.nextInt();
        }

        int temp = 1000000001;
        for(int i=n-1;i>-1;i--){
            int now = input[i];
            //System.out.println("temp=" + temp + " now=" + now);
            if(temp >= now){
                temp = now;
                continue;
            }else if (temp >= now-1){
                temp = now-1;
                continue;
            }else{
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");



    }
} Main public static boolean debug = true; debug true public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] input = new int[n];
        for(int i=0;i<n;i++){
            input[i] = sc.nextInt();
        }

        int temp = 1000000001;
        for(int i=n-1;i>-1;i--){
            int now = input[i];
            //System.out.println("temp=" + temp + " now=" + now);
            if(temp >= now){
                temp = now;
                continue;
            }else if (temp >= now-1){
                temp = now-1;
                continue;
            }else{
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");



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

        int temp = 1000000001;
        for(int i=n-1;i>-1;i--){
            int now = input[i];
            //System.out.println("temp=" + temp + " now=" + now);
            if(temp >= now){
                temp = now;
                continue;
            }else if (temp >= now-1){
                temp = now-1;
                continue;
            }else{
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");



    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] input = new int[n]; input new int[n] n for(int i=0;i<n;i++){
            input[i] = sc.nextInt();
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            input[i] = sc.nextInt();
        } {
            input[i] = sc.nextInt();
        } input[i] = sc.nextInt() input[i] input i sc.nextInt() sc.nextInt sc int temp = 1000000001; temp 1000000001 for(int i=n-1;i>-1;i--){
            int now = input[i];
            //System.out.println("temp=" + temp + " now=" + now);
            if(temp >= now){
                temp = now;
                continue;
            }else if (temp >= now-1){
                temp = now-1;
                continue;
            }else{
                System.out.println("No");
                return;
            }
        } int i=n-1; int i=n-1; i n-1 n 1 i>-1 i -1 1 i-- i-- i {
            int now = input[i];
            //System.out.println("temp=" + temp + " now=" + now);
            if(temp >= now){
                temp = now;
                continue;
            }else if (temp >= now-1){
                temp = now-1;
                continue;
            }else{
                System.out.println("No");
                return;
            }
        } {
            int now = input[i];
            //System.out.println("temp=" + temp + " now=" + now);
            if(temp >= now){
                temp = now;
                continue;
            }else if (temp >= now-1){
                temp = now-1;
                continue;
            }else{
                System.out.println("No");
                return;
            }
        } int now = input[i]; now input[i] input i if(temp >= now){
                temp = now;
                continue;
            }else if (temp >= now-1){
                temp = now-1;
                continue;
            }else{
                System.out.println("No");
                return;
            } temp >= now temp now {
                temp = now;
                continue;
            } temp = now temp now continue; if (temp >= now-1){
                temp = now-1;
                continue;
            }else{
                System.out.println("No");
                return;
            } temp >= now-1 temp now-1 now 1 {
                temp = now-1;
                continue;
            } temp = now-1 temp now-1 now 1 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 boolean debug = true;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] input = new int[n];
        for(int i=0;i<n;i++){
            input[i] = sc.nextInt();
        }

        int temp = 1000000001;
        for(int i=n-1;i>-1;i--){
            int now = input[i];
            //System.out.println("temp=" + temp + " now=" + now);
            if(temp >= now){
                temp = now;
                continue;
            }else if (temp >= now-1){
                temp = now-1;
                continue;
            }else{
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");



    }
} public class Main {
    public static boolean debug = true;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] input = new int[n];
        for(int i=0;i<n;i++){
            input[i] = sc.nextInt();
        }

        int temp = 1000000001;
        for(int i=n-1;i>-1;i--){
            int now = input[i];
            //System.out.println("temp=" + temp + " now=" + now);
            if(temp >= now){
                temp = now;
                continue;
            }else if (temp >= now-1){
                temp = now-1;
                continue;
            }else{
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");



    }
} Main
import java.util.Scanner;

public class Main {
    public static boolean debug = true;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] input = new int[n];
        for(int i=0;i<n;i++){
            input[i] = sc.nextInt();
        }

        int temp = 1000000001;
        for(int i=n-1;i>-1;i--){
            int now = input[i];
            //System.out.println("temp=" + temp + " now=" + now);
            if(temp >= now){
                temp = now;
                continue;
            }else if (temp >= now-1){
                temp = now-1;
                continue;
            }else{
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");



    }
}