import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        long[] ar = new long[n];

        for (int i = 0; i < ar.length; i++) {
            ar[i] = scan.nextLong();
        }


        boolean flag = true;
        for (int i = ar.length - 2; i >= 0; i--) {
            if (ar[i + 1] < ar[i] && ar[i] - ar[i + 1] > 1) {
                flag = false;
                break;
            }else if(ar[i + 1] < ar[i] && ar[i] - ar[i + 1] == 1){
                ar[i]--;
            }
        }

        System.out.println(flag ? "Yes" : "No");
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        long[] ar = new long[n];

        for (int i = 0; i < ar.length; i++) {
            ar[i] = scan.nextLong();
        }


        boolean flag = true;
        for (int i = ar.length - 2; i >= 0; i--) {
            if (ar[i + 1] < ar[i] && ar[i] - ar[i + 1] > 1) {
                flag = false;
                break;
            }else if(ar[i + 1] < ar[i] && ar[i] - ar[i + 1] == 1){
                ar[i]--;
            }
        }

        System.out.println(flag ? "Yes" : "No");
    }
} Main public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        long[] ar = new long[n];

        for (int i = 0; i < ar.length; i++) {
            ar[i] = scan.nextLong();
        }


        boolean flag = true;
        for (int i = ar.length - 2; i >= 0; i--) {
            if (ar[i + 1] < ar[i] && ar[i] - ar[i + 1] > 1) {
                flag = false;
                break;
            }else if(ar[i + 1] < ar[i] && ar[i] - ar[i + 1] == 1){
                ar[i]--;
            }
        }

        System.out.println(flag ? "Yes" : "No");
    } main {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        long[] ar = new long[n];

        for (int i = 0; i < ar.length; i++) {
            ar[i] = scan.nextLong();
        }


        boolean flag = true;
        for (int i = ar.length - 2; i >= 0; i--) {
            if (ar[i + 1] < ar[i] && ar[i] - ar[i + 1] > 1) {
                flag = false;
                break;
            }else if(ar[i + 1] < ar[i] && ar[i] - ar[i + 1] == 1){
                ar[i]--;
            }
        }

        System.out.println(flag ? "Yes" : "No");
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan long[] ar = new long[n]; ar new long[n] n for (int i = 0; i < ar.length; i++) {
            ar[i] = scan.nextLong();
        } int i = 0; int i = 0; i 0 i < ar.length i ar.length ar ar.length i++ i++ i {
            ar[i] = scan.nextLong();
        } {
            ar[i] = scan.nextLong();
        } ar[i] = scan.nextLong() ar[i] ar i scan.nextLong() scan.nextLong scan boolean flag = true; flag true for (int i = ar.length - 2; i >= 0; i--) {
            if (ar[i + 1] < ar[i] && ar[i] - ar[i + 1] > 1) {
                flag = false;
                break;
            }else if(ar[i + 1] < ar[i] && ar[i] - ar[i + 1] == 1){
                ar[i]--;
            }
        } int i = ar.length - 2; int i = ar.length - 2; i ar.length - 2 ar.length ar ar.length 2 i >= 0 i 0 i-- i-- i {
            if (ar[i + 1] < ar[i] && ar[i] - ar[i + 1] > 1) {
                flag = false;
                break;
            }else if(ar[i + 1] < ar[i] && ar[i] - ar[i + 1] == 1){
                ar[i]--;
            }
        } {
            if (ar[i + 1] < ar[i] && ar[i] - ar[i + 1] > 1) {
                flag = false;
                break;
            }else if(ar[i + 1] < ar[i] && ar[i] - ar[i + 1] == 1){
                ar[i]--;
            }
        } if (ar[i + 1] < ar[i] && ar[i] - ar[i + 1] > 1) {
                flag = false;
                break;
            }else if(ar[i + 1] < ar[i] && ar[i] - ar[i + 1] == 1){
                ar[i]--;
            } ar[i + 1] < ar[i] && ar[i] - ar[i + 1] > 1 ar[i + 1] < ar[i] ar[i + 1] ar i + 1 i 1 ar[i] ar i ar[i] - ar[i + 1] > 1 ar[i] - ar[i + 1] ar[i] ar i ar[i + 1] ar i + 1 i 1 1 {
                flag = false;
                break;
            } flag = false flag false break; if(ar[i + 1] < ar[i] && ar[i] - ar[i + 1] == 1){
                ar[i]--;
            } ar[i + 1] < ar[i] && ar[i] - ar[i + 1] == 1 ar[i + 1] < ar[i] ar[i + 1] ar i + 1 i 1 ar[i] ar i ar[i] - ar[i + 1] == 1 ar[i] - ar[i + 1] ar[i] ar i ar[i + 1] ar i + 1 i 1 1 {
                ar[i]--;
            } ar[i]-- ar[i] ar i System.out.println(flag ? "Yes" : "No") System.out.println System.out System System.out flag ? "Yes" : "No" flag "Yes" "No" String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        long[] ar = new long[n];

        for (int i = 0; i < ar.length; i++) {
            ar[i] = scan.nextLong();
        }


        boolean flag = true;
        for (int i = ar.length - 2; i >= 0; i--) {
            if (ar[i + 1] < ar[i] && ar[i] - ar[i + 1] > 1) {
                flag = false;
                break;
            }else if(ar[i + 1] < ar[i] && ar[i] - ar[i + 1] == 1){
                ar[i]--;
            }
        }

        System.out.println(flag ? "Yes" : "No");
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        long[] ar = new long[n];

        for (int i = 0; i < ar.length; i++) {
            ar[i] = scan.nextLong();
        }


        boolean flag = true;
        for (int i = ar.length - 2; i >= 0; i--) {
            if (ar[i + 1] < ar[i] && ar[i] - ar[i + 1] > 1) {
                flag = false;
                break;
            }else if(ar[i + 1] < ar[i] && ar[i] - ar[i + 1] == 1){
                ar[i]--;
            }
        }

        System.out.println(flag ? "Yes" : "No");
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        long[] ar = new long[n];

        for (int i = 0; i < ar.length; i++) {
            ar[i] = scan.nextLong();
        }


        boolean flag = true;
        for (int i = ar.length - 2; i >= 0; i--) {
            if (ar[i + 1] < ar[i] && ar[i] - ar[i + 1] > 1) {
                flag = false;
                break;
            }else if(ar[i + 1] < ar[i] && ar[i] - ar[i + 1] == 1){
                ar[i]--;
            }
        }

        System.out.println(flag ? "Yes" : "No");
    }
}
