
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        boolean cantReducedAnyMore = false;
        int previous = sc.nextInt();
        int current ;
        String result = "Yes";
        while (sc.hasNext()){
            current = sc.nextInt();
            int diff = current - previous;
            if(diff > 0){
                cantReducedAnyMore = false;
            } else if(diff == -1){
                if(cantReducedAnyMore){
                    result = "No";
                    break;
                }else {
                    cantReducedAnyMore = true;
                }
            }else if(diff < -1){
                result = "No";
                break;
            }
            previous = current;
        }
        System.out.println(result);
    }

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

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        boolean cantReducedAnyMore = false;
        int previous = sc.nextInt();
        int current ;
        String result = "Yes";
        while (sc.hasNext()){
            current = sc.nextInt();
            int diff = current - previous;
            if(diff > 0){
                cantReducedAnyMore = false;
            } else if(diff == -1){
                if(cantReducedAnyMore){
                    result = "No";
                    break;
                }else {
                    cantReducedAnyMore = true;
                }
            }else if(diff < -1){
                result = "No";
                break;
            }
            previous = current;
        }
        System.out.println(result);
    }

} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        boolean cantReducedAnyMore = false;
        int previous = sc.nextInt();
        int current ;
        String result = "Yes";
        while (sc.hasNext()){
            current = sc.nextInt();
            int diff = current - previous;
            if(diff > 0){
                cantReducedAnyMore = false;
            } else if(diff == -1){
                if(cantReducedAnyMore){
                    result = "No";
                    break;
                }else {
                    cantReducedAnyMore = true;
                }
            }else if(diff < -1){
                result = "No";
                break;
            }
            previous = current;
        }
        System.out.println(result);
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        boolean cantReducedAnyMore = false;
        int previous = sc.nextInt();
        int current ;
        String result = "Yes";
        while (sc.hasNext()){
            current = sc.nextInt();
            int diff = current - previous;
            if(diff > 0){
                cantReducedAnyMore = false;
            } else if(diff == -1){
                if(cantReducedAnyMore){
                    result = "No";
                    break;
                }else {
                    cantReducedAnyMore = true;
                }
            }else if(diff < -1){
                result = "No";
                break;
            }
            previous = current;
        }
        System.out.println(result);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc boolean cantReducedAnyMore = false; cantReducedAnyMore false int previous = sc.nextInt(); previous sc.nextInt() sc.nextInt sc int current ; current String result = "Yes"; result "Yes" while (sc.hasNext()){
            current = sc.nextInt();
            int diff = current - previous;
            if(diff > 0){
                cantReducedAnyMore = false;
            } else if(diff == -1){
                if(cantReducedAnyMore){
                    result = "No";
                    break;
                }else {
                    cantReducedAnyMore = true;
                }
            }else if(diff < -1){
                result = "No";
                break;
            }
            previous = current;
        } sc.hasNext() sc.hasNext sc {
            current = sc.nextInt();
            int diff = current - previous;
            if(diff > 0){
                cantReducedAnyMore = false;
            } else if(diff == -1){
                if(cantReducedAnyMore){
                    result = "No";
                    break;
                }else {
                    cantReducedAnyMore = true;
                }
            }else if(diff < -1){
                result = "No";
                break;
            }
            previous = current;
        } current = sc.nextInt() current sc.nextInt() sc.nextInt sc int diff = current - previous; diff current - previous current previous if(diff > 0){
                cantReducedAnyMore = false;
            } else if(diff == -1){
                if(cantReducedAnyMore){
                    result = "No";
                    break;
                }else {
                    cantReducedAnyMore = true;
                }
            }else if(diff < -1){
                result = "No";
                break;
            } diff > 0 diff 0 {
                cantReducedAnyMore = false;
            } cantReducedAnyMore = false cantReducedAnyMore false if(diff == -1){
                if(cantReducedAnyMore){
                    result = "No";
                    break;
                }else {
                    cantReducedAnyMore = true;
                }
            }else if(diff < -1){
                result = "No";
                break;
            } diff == -1 diff -1 1 {
                if(cantReducedAnyMore){
                    result = "No";
                    break;
                }else {
                    cantReducedAnyMore = true;
                }
            } if(cantReducedAnyMore){
                    result = "No";
                    break;
                }else {
                    cantReducedAnyMore = true;
                } cantReducedAnyMore {
                    result = "No";
                    break;
                } result = "No" result "No" break; {
                    cantReducedAnyMore = true;
                } cantReducedAnyMore = true cantReducedAnyMore true if(diff < -1){
                result = "No";
                break;
            } diff < -1 diff -1 1 {
                result = "No";
                break;
            } result = "No" result "No" break; previous = current previous current System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        boolean cantReducedAnyMore = false;
        int previous = sc.nextInt();
        int current ;
        String result = "Yes";
        while (sc.hasNext()){
            current = sc.nextInt();
            int diff = current - previous;
            if(diff > 0){
                cantReducedAnyMore = false;
            } else if(diff == -1){
                if(cantReducedAnyMore){
                    result = "No";
                    break;
                }else {
                    cantReducedAnyMore = true;
                }
            }else if(diff < -1){
                result = "No";
                break;
            }
            previous = current;
        }
        System.out.println(result);
    }

} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        boolean cantReducedAnyMore = false;
        int previous = sc.nextInt();
        int current ;
        String result = "Yes";
        while (sc.hasNext()){
            current = sc.nextInt();
            int diff = current - previous;
            if(diff > 0){
                cantReducedAnyMore = false;
            } else if(diff == -1){
                if(cantReducedAnyMore){
                    result = "No";
                    break;
                }else {
                    cantReducedAnyMore = true;
                }
            }else if(diff < -1){
                result = "No";
                break;
            }
            previous = current;
        }
        System.out.println(result);
    }

} Main

import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        boolean cantReducedAnyMore = false;
        int previous = sc.nextInt();
        int current ;
        String result = "Yes";
        while (sc.hasNext()){
            current = sc.nextInt();
            int diff = current - previous;
            if(diff > 0){
                cantReducedAnyMore = false;
            } else if(diff == -1){
                if(cantReducedAnyMore){
                    result = "No";
                    break;
                }else {
                    cantReducedAnyMore = true;
                }
            }else if(diff < -1){
                result = "No";
                break;
            }
            previous = current;
        }
        System.out.println(result);
    }

}
