import java.util.*;

class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
}

class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] H = new int[N];
        for (int i = 0; i < N; i++) {
            H[i] = sc.nextInt();
        }
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < N - 1; i++) {
            if (H[i] <= H[i + 1] - 1) {
                // ok. making H[i + 1] lower than current status.
                H[i + 1] -= 1;
            } else if (H[i] == H[i + 1]) {
                // ok. no change.
            } else {
                System.out.println("No");
                return;
            }
        }

        System.out.println("Yes");
        return;
    }

} import java.util.*; util.* java class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
} Main public static void main(String[] args) {
        new Solver().run();
    } main {
        new Solver().run();
    } new Solver().run() new Solver().run new Solver() String[] args args class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] H = new int[N];
        for (int i = 0; i < N; i++) {
            H[i] = sc.nextInt();
        }
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < N - 1; i++) {
            if (H[i] <= H[i + 1] - 1) {
                // ok. making H[i + 1] lower than current status.
                H[i + 1] -= 1;
            } else if (H[i] == H[i + 1]) {
                // ok. no change.
            } else {
                System.out.println("No");
                return;
            }
        }

        System.out.println("Yes");
        return;
    }

} Solver public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] H = new int[N];
        for (int i = 0; i < N; i++) {
            H[i] = sc.nextInt();
        }
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < N - 1; i++) {
            if (H[i] <= H[i + 1] - 1) {
                // ok. making H[i + 1] lower than current status.
                H[i + 1] -= 1;
            } else if (H[i] == H[i + 1]) {
                // ok. no change.
            } else {
                System.out.println("No");
                return;
            }
        }

        System.out.println("Yes");
        return;
    } run {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] H = new int[N];
        for (int i = 0; i < N; i++) {
            H[i] = sc.nextInt();
        }
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < N - 1; i++) {
            if (H[i] <= H[i + 1] - 1) {
                // ok. making H[i + 1] lower than current status.
                H[i + 1] -= 1;
            } else if (H[i] == H[i + 1]) {
                // ok. no change.
            } else {
                System.out.println("No");
                return;
            }
        }

        System.out.println("Yes");
        return;
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt 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 int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int i = 0; i < N - 1; i++) {
            if (H[i] <= H[i + 1] - 1) {
                // ok. making H[i + 1] lower than current status.
                H[i + 1] -= 1;
            } else if (H[i] == H[i + 1]) {
                // ok. no change.
            } else {
                System.out.println("No");
                return;
            }
        } int i = 0; int i = 0; i 0 i < N - 1 i N - 1 N 1 i++ i++ i {
            if (H[i] <= H[i + 1] - 1) {
                // ok. making H[i + 1] lower than current status.
                H[i + 1] -= 1;
            } else if (H[i] == H[i + 1]) {
                // ok. no change.
            } else {
                System.out.println("No");
                return;
            }
        } {
            if (H[i] <= H[i + 1] - 1) {
                // ok. making H[i + 1] lower than current status.
                H[i + 1] -= 1;
            } else if (H[i] == H[i + 1]) {
                // ok. no change.
            } else {
                System.out.println("No");
                return;
            }
        } if (H[i] <= H[i + 1] - 1) {
                // ok. making H[i + 1] lower than current status.
                H[i + 1] -= 1;
            } else if (H[i] == H[i + 1]) {
                // ok. no change.
            } else {
                System.out.println("No");
                return;
            } H[i] <= H[i + 1] - 1 H[i] H i H[i + 1] - 1 H[i + 1] H i + 1 i 1 1 {
                // ok. making H[i + 1] lower than current status.
                H[i + 1] -= 1;
            } H[i + 1] -= 1 H[i + 1] H i + 1 i 1 1 if (H[i] == H[i + 1]) {
                // ok. no change.
            } else {
                System.out.println("No");
                return;
            } H[i] == H[i + 1] H[i] H i H[i + 1] H i + 1 i 1 {
                // ok. no change.
            } {
                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" return;
import java.util.*;

class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
}

class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] H = new int[N];
        for (int i = 0; i < N; i++) {
            H[i] = sc.nextInt();
        }
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < N - 1; i++) {
            if (H[i] <= H[i + 1] - 1) {
                // ok. making H[i + 1] lower than current status.
                H[i + 1] -= 1;
            } else if (H[i] == H[i + 1]) {
                // ok. no change.
            } else {
                System.out.println("No");
                return;
            }
        }

        System.out.println("Yes");
        return;
    }

}