import java.util.Scanner;

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

    private void run() {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] H = new int[N];
        for(int i = 0; i < N; i++) {
            H[i] = scanner.nextInt();
        }
        if(N==1){
            System.out.println("Yes");
            return;
        }

        for(int i = N-1; i > 0; i--) {
            if(H[i] == H[i-1]){
                continue;
            }else if(H[i] > H[i-1]){
                continue;
            }else if(H[i] + 1 == H[i-1]){
                H[i-1]--;
            }else{
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String args[]) {
        new Main().run();
    }

    private void run() {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] H = new int[N];
        for(int i = 0; i < N; i++) {
            H[i] = scanner.nextInt();
        }
        if(N==1){
            System.out.println("Yes");
            return;
        }

        for(int i = N-1; i > 0; i--) {
            if(H[i] == H[i-1]){
                continue;
            }else if(H[i] > H[i-1]){
                continue;
            }else if(H[i] + 1 == H[i-1]){
                H[i-1]--;
            }else{
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
} Main public static void main(String args[]) {
        new Main().run();
    } main {
        new Main().run();
    } new Main().run() new Main().run new Main() String args[] args private void run() {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] H = new int[N];
        for(int i = 0; i < N; i++) {
            H[i] = scanner.nextInt();
        }
        if(N==1){
            System.out.println("Yes");
            return;
        }

        for(int i = N-1; i > 0; i--) {
            if(H[i] == H[i-1]){
                continue;
            }else if(H[i] > H[i-1]){
                continue;
            }else if(H[i] + 1 == H[i-1]){
                H[i-1]--;
            }else{
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    } run {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] H = new int[N];
        for(int i = 0; i < N; i++) {
            H[i] = scanner.nextInt();
        }
        if(N==1){
            System.out.println("Yes");
            return;
        }

        for(int i = N-1; i > 0; i--) {
            if(H[i] == H[i-1]){
                continue;
            }else if(H[i] > H[i-1]){
                continue;
            }else if(H[i] + 1 == H[i-1]){
                H[i-1]--;
            }else{
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner int[] H = new int[N]; H new int[N] N for(int i = 0; i < N; i++) {
            H[i] = scanner.nextInt();
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            H[i] = scanner.nextInt();
        } {
            H[i] = scanner.nextInt();
        } H[i] = scanner.nextInt() H[i] H i scanner.nextInt() scanner.nextInt scanner if(N==1){
            System.out.println("Yes");
            return;
        } N==1 N 1 {
            System.out.println("Yes");
            return;
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" return; for(int i = N-1; i > 0; i--) {
            if(H[i] == H[i-1]){
                continue;
            }else if(H[i] > H[i-1]){
                continue;
            }else if(H[i] + 1 == H[i-1]){
                H[i-1]--;
            }else{
                System.out.println("No");
                return;
            }
        } int i = N-1; int i = N-1; i N-1 N 1 i > 0 i 0 i-- i-- i {
            if(H[i] == H[i-1]){
                continue;
            }else if(H[i] > H[i-1]){
                continue;
            }else if(H[i] + 1 == H[i-1]){
                H[i-1]--;
            }else{
                System.out.println("No");
                return;
            }
        } {
            if(H[i] == H[i-1]){
                continue;
            }else if(H[i] > H[i-1]){
                continue;
            }else if(H[i] + 1 == H[i-1]){
                H[i-1]--;
            }else{
                System.out.println("No");
                return;
            }
        } if(H[i] == H[i-1]){
                continue;
            }else if(H[i] > H[i-1]){
                continue;
            }else if(H[i] + 1 == H[i-1]){
                H[i-1]--;
            }else{
                System.out.println("No");
                return;
            } H[i] == H[i-1] H[i] H i H[i-1] H i-1 i 1 {
                continue;
            } continue; if(H[i] > H[i-1]){
                continue;
            }else if(H[i] + 1 == H[i-1]){
                H[i-1]--;
            }else{
                System.out.println("No");
                return;
            } H[i] > H[i-1] H[i] H i H[i-1] H i-1 i 1 {
                continue;
            } continue; if(H[i] + 1 == H[i-1]){
                H[i-1]--;
            }else{
                System.out.println("No");
                return;
            } H[i] + 1 == H[i-1] H[i] + 1 H[i] H i 1 H[i-1] H i-1 i 1 {
                H[i-1]--;
            } H[i-1]-- H[i-1] H i-1 i 1 {
                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" public class Main {
    public static void main(String args[]) {
        new Main().run();
    }

    private void run() {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] H = new int[N];
        for(int i = 0; i < N; i++) {
            H[i] = scanner.nextInt();
        }
        if(N==1){
            System.out.println("Yes");
            return;
        }

        for(int i = N-1; i > 0; i--) {
            if(H[i] == H[i-1]){
                continue;
            }else if(H[i] > H[i-1]){
                continue;
            }else if(H[i] + 1 == H[i-1]){
                H[i-1]--;
            }else{
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
} public class Main {
    public static void main(String args[]) {
        new Main().run();
    }

    private void run() {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] H = new int[N];
        for(int i = 0; i < N; i++) {
            H[i] = scanner.nextInt();
        }
        if(N==1){
            System.out.println("Yes");
            return;
        }

        for(int i = N-1; i > 0; i--) {
            if(H[i] == H[i-1]){
                continue;
            }else if(H[i] > H[i-1]){
                continue;
            }else if(H[i] + 1 == H[i-1]){
                H[i-1]--;
            }else{
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
} Main
import java.util.Scanner;

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

    private void run() {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] H = new int[N];
        for(int i = 0; i < N; i++) {
            H[i] = scanner.nextInt();
        }
        if(N==1){
            System.out.println("Yes");
            return;
        }

        for(int i = N-1; i > 0; i--) {
            if(H[i] == H[i-1]){
                continue;
            }else if(H[i] > H[i-1]){
                continue;
            }else if(H[i] + 1 == H[i-1]){
                H[i-1]--;
            }else{
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
}
