import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        boolean ansFlag = true;
        int max = Integer.parseInt(sc.next()) - 1;
        for(int i = 1;i<n;i++){
            int tmp = Integer.parseInt(sc.next());
            if(tmp > max){
                tmp -= 1;
            }
            if(tmp < max){
                ansFlag = false;
                break;
            }
            max = Math.max(max,tmp);
        }
        if(ansFlag){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        boolean ansFlag = true;
        int max = Integer.parseInt(sc.next()) - 1;
        for(int i = 1;i<n;i++){
            int tmp = Integer.parseInt(sc.next());
            if(tmp > max){
                tmp -= 1;
            }
            if(tmp < max){
                ansFlag = false;
                break;
            }
            max = Math.max(max,tmp);
        }
        if(ansFlag){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        boolean ansFlag = true;
        int max = Integer.parseInt(sc.next()) - 1;
        for(int i = 1;i<n;i++){
            int tmp = Integer.parseInt(sc.next());
            if(tmp > max){
                tmp -= 1;
            }
            if(tmp < max){
                ansFlag = false;
                break;
            }
            max = Math.max(max,tmp);
        }
        if(ansFlag){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        boolean ansFlag = true;
        int max = Integer.parseInt(sc.next()) - 1;
        for(int i = 1;i<n;i++){
            int tmp = Integer.parseInt(sc.next());
            if(tmp > max){
                tmp -= 1;
            }
            if(tmp < max){
                ansFlag = false;
                break;
            }
            max = Math.max(max,tmp);
        }
        if(ansFlag){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc boolean ansFlag = true; ansFlag true int max = Integer.parseInt(sc.next()) - 1; max Integer.parseInt(sc.next()) - 1 Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc 1 for(int i = 1;i<n;i++){
            int tmp = Integer.parseInt(sc.next());
            if(tmp > max){
                tmp -= 1;
            }
            if(tmp < max){
                ansFlag = false;
                break;
            }
            max = Math.max(max,tmp);
        } int i = 1; int i = 1; i 1 i<n i n i++ i++ i {
            int tmp = Integer.parseInt(sc.next());
            if(tmp > max){
                tmp -= 1;
            }
            if(tmp < max){
                ansFlag = false;
                break;
            }
            max = Math.max(max,tmp);
        } {
            int tmp = Integer.parseInt(sc.next());
            if(tmp > max){
                tmp -= 1;
            }
            if(tmp < max){
                ansFlag = false;
                break;
            }
            max = Math.max(max,tmp);
        } int tmp = Integer.parseInt(sc.next()); tmp Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc if(tmp > max){
                tmp -= 1;
            } tmp > max tmp max {
                tmp -= 1;
            } tmp -= 1 tmp 1 if(tmp < max){
                ansFlag = false;
                break;
            } tmp < max tmp max {
                ansFlag = false;
                break;
            } ansFlag = false ansFlag false break; max = Math.max(max,tmp) max Math.max(max,tmp) Math.max Math max tmp if(ansFlag){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        } ansFlag {
            System.out.println("Yes");
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
            System.out.println("No");
        } System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        boolean ansFlag = true;
        int max = Integer.parseInt(sc.next()) - 1;
        for(int i = 1;i<n;i++){
            int tmp = Integer.parseInt(sc.next());
            if(tmp > max){
                tmp -= 1;
            }
            if(tmp < max){
                ansFlag = false;
                break;
            }
            max = Math.max(max,tmp);
        }
        if(ansFlag){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        boolean ansFlag = true;
        int max = Integer.parseInt(sc.next()) - 1;
        for(int i = 1;i<n;i++){
            int tmp = Integer.parseInt(sc.next());
            if(tmp > max){
                tmp -= 1;
            }
            if(tmp < max){
                ansFlag = false;
                break;
            }
            max = Math.max(max,tmp);
        }
        if(ansFlag){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        boolean ansFlag = true;
        int max = Integer.parseInt(sc.next()) - 1;
        for(int i = 1;i<n;i++){
            int tmp = Integer.parseInt(sc.next());
            if(tmp > max){
                tmp -= 1;
            }
            if(tmp < max){
                ansFlag = false;
                break;
            }
            max = Math.max(max,tmp);
        }
        if(ansFlag){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}