
import java.util.*;

public class Main {


    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a = new int[n];

        for (int i = 0; i < n; i++) {

            a[i] = in.nextInt();

        }


        for (int i = n - 2; i >= 0; i--) {

            if (a[i] > a[i+1]) {
                if (Math.abs(a[i] - a[i + 1]) > 1) {
                    System.out.println("No");
                    return;
                } else {
                    a[i]--;
                }
            }

        }

        System.out.println("Yes");

    }


} import java.util.*; util.* java public class Main {


    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a = new int[n];

        for (int i = 0; i < n; i++) {

            a[i] = in.nextInt();

        }


        for (int i = n - 2; i >= 0; i--) {

            if (a[i] > a[i+1]) {
                if (Math.abs(a[i] - a[i + 1]) > 1) {
                    System.out.println("No");
                    return;
                } else {
                    a[i]--;
                }
            }

        }

        System.out.println("Yes");

    }


} Main public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a = new int[n];

        for (int i = 0; i < n; i++) {

            a[i] = in.nextInt();

        }


        for (int i = n - 2; i >= 0; i--) {

            if (a[i] > a[i+1]) {
                if (Math.abs(a[i] - a[i + 1]) > 1) {
                    System.out.println("No");
                    return;
                } else {
                    a[i]--;
                }
            }

        }

        System.out.println("Yes");

    } main {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a = new int[n];

        for (int i = 0; i < n; i++) {

            a[i] = in.nextInt();

        }


        for (int i = n - 2; i >= 0; i--) {

            if (a[i] > a[i+1]) {
                if (Math.abs(a[i] - a[i + 1]) > 1) {
                    System.out.println("No");
                    return;
                } else {
                    a[i]--;
                }
            }

        }

        System.out.println("Yes");

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

            a[i] = in.nextInt();

        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {

            a[i] = in.nextInt();

        } {

            a[i] = in.nextInt();

        } a[i] = in.nextInt() a[i] a i in.nextInt() in.nextInt in for (int i = n - 2; i >= 0; i--) {

            if (a[i] > a[i+1]) {
                if (Math.abs(a[i] - a[i + 1]) > 1) {
                    System.out.println("No");
                    return;
                } else {
                    a[i]--;
                }
            }

        } int i = n - 2; int i = n - 2; i n - 2 n 2 i >= 0 i 0 i-- i-- i {

            if (a[i] > a[i+1]) {
                if (Math.abs(a[i] - a[i + 1]) > 1) {
                    System.out.println("No");
                    return;
                } else {
                    a[i]--;
                }
            }

        } {

            if (a[i] > a[i+1]) {
                if (Math.abs(a[i] - a[i + 1]) > 1) {
                    System.out.println("No");
                    return;
                } else {
                    a[i]--;
                }
            }

        } if (a[i] > a[i+1]) {
                if (Math.abs(a[i] - a[i + 1]) > 1) {
                    System.out.println("No");
                    return;
                } else {
                    a[i]--;
                }
            } a[i] > a[i+1] a[i] a i a[i+1] a i+1 i 1 {
                if (Math.abs(a[i] - a[i + 1]) > 1) {
                    System.out.println("No");
                    return;
                } else {
                    a[i]--;
                }
            } if (Math.abs(a[i] - a[i + 1]) > 1) {
                    System.out.println("No");
                    return;
                } else {
                    a[i]--;
                } Math.abs(a[i] - a[i + 1]) > 1 Math.abs(a[i] - a[i + 1]) Math.abs Math a[i] - a[i + 1] a[i] a i a[i + 1] a i + 1 i 1 1 {
                    System.out.println("No");
                    return;
                } System.out.println("No") System.out.println System.out System System.out "No" return; {
                    a[i]--;
                } a[i]-- a[i] a i System.out.println("Yes") System.out.println System.out System System.out "Yes" String[] args args public class Main {


    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a = new int[n];

        for (int i = 0; i < n; i++) {

            a[i] = in.nextInt();

        }


        for (int i = n - 2; i >= 0; i--) {

            if (a[i] > a[i+1]) {
                if (Math.abs(a[i] - a[i + 1]) > 1) {
                    System.out.println("No");
                    return;
                } else {
                    a[i]--;
                }
            }

        }

        System.out.println("Yes");

    }


} public class Main {


    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a = new int[n];

        for (int i = 0; i < n; i++) {

            a[i] = in.nextInt();

        }


        for (int i = n - 2; i >= 0; i--) {

            if (a[i] > a[i+1]) {
                if (Math.abs(a[i] - a[i + 1]) > 1) {
                    System.out.println("No");
                    return;
                } else {
                    a[i]--;
                }
            }

        }

        System.out.println("Yes");

    }


} Main

import java.util.*;

public class Main {


    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a = new int[n];

        for (int i = 0; i < n; i++) {

            a[i] = in.nextInt();

        }


        for (int i = n - 2; i >= 0; i--) {

            if (a[i] > a[i+1]) {
                if (Math.abs(a[i] - a[i + 1]) > 1) {
                    System.out.println("No");
                    return;
                } else {
                    a[i]--;
                }
            }

        }

        System.out.println("Yes");

    }


}
