import java.util.ArrayList;
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        ArrayList<Integer> l = new ArrayList<>();
        for(int i = 0; i < N;i++){
            l.add(Integer.parseInt(sc.next()));
        }
        int previous = Integer.MIN_VALUE;
        for(Integer now : l){
            if(previous <= now - 1){
                previous = now - 1;
            }else if(previous <= now){
                previous = now;
            }else{
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        ArrayList<Integer> l = new ArrayList<>();
        for(int i = 0; i < N;i++){
            l.add(Integer.parseInt(sc.next()));
        }
        int previous = Integer.MIN_VALUE;
        for(Integer now : l){
            if(previous <= now - 1){
                previous = now - 1;
            }else if(previous <= now){
                previous = now;
            }else{
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        ArrayList<Integer> l = new ArrayList<>();
        for(int i = 0; i < N;i++){
            l.add(Integer.parseInt(sc.next()));
        }
        int previous = Integer.MIN_VALUE;
        for(Integer now : l){
            if(previous <= now - 1){
                previous = now - 1;
            }else if(previous <= now){
                previous = now;
            }else{
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    } main {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        ArrayList<Integer> l = new ArrayList<>();
        for(int i = 0; i < N;i++){
            l.add(Integer.parseInt(sc.next()));
        }
        int previous = Integer.MIN_VALUE;
        for(Integer now : l){
            if(previous <= now - 1){
                previous = now - 1;
            }else if(previous <= now){
                previous = now;
            }else{
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    } 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 ArrayList<Integer> l = new ArrayList<>(); l new ArrayList<>() for(int i = 0; i < N;i++){
            l.add(Integer.parseInt(sc.next()));
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            l.add(Integer.parseInt(sc.next()));
        } {
            l.add(Integer.parseInt(sc.next()));
        } l.add(Integer.parseInt(sc.next())) l.add l Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int previous = Integer.MIN_VALUE; previous Integer.MIN_VALUE Integer Integer.MIN_VALUE for(Integer now : l){
            if(previous <= now - 1){
                previous = now - 1;
            }else if(previous <= now){
                previous = now;
            }else{
                System.out.println("No");
                return;
            }
        } Integer now l {
            if(previous <= now - 1){
                previous = now - 1;
            }else if(previous <= now){
                previous = now;
            }else{
                System.out.println("No");
                return;
            }
        } {
            if(previous <= now - 1){
                previous = now - 1;
            }else if(previous <= now){
                previous = now;
            }else{
                System.out.println("No");
                return;
            }
        } if(previous <= now - 1){
                previous = now - 1;
            }else if(previous <= now){
                previous = now;
            }else{
                System.out.println("No");
                return;
            } previous <= now - 1 previous now - 1 now 1 {
                previous = now - 1;
            } previous = now - 1 previous now - 1 now 1 if(previous <= now){
                previous = now;
            }else{
                System.out.println("No");
                return;
            } previous <= now previous now {
                previous = now;
            } previous = now previous now {
                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" String[] args args public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        ArrayList<Integer> l = new ArrayList<>();
        for(int i = 0; i < N;i++){
            l.add(Integer.parseInt(sc.next()));
        }
        int previous = Integer.MIN_VALUE;
        for(Integer now : l){
            if(previous <= now - 1){
                previous = now - 1;
            }else if(previous <= now){
                previous = now;
            }else{
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        ArrayList<Integer> l = new ArrayList<>();
        for(int i = 0; i < N;i++){
            l.add(Integer.parseInt(sc.next()));
        }
        int previous = Integer.MIN_VALUE;
        for(Integer now : l){
            if(previous <= now - 1){
                previous = now - 1;
            }else if(previous <= now){
                previous = now;
            }else{
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
} Main
import java.util.ArrayList;
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        ArrayList<Integer> l = new ArrayList<>();
        for(int i = 0; i < N;i++){
            l.add(Integer.parseInt(sc.next()));
        }
        int previous = Integer.MIN_VALUE;
        for(Integer now : l){
            if(previous <= now - 1){
                previous = now - 1;
            }else if(previous <= now){
                previous = now;
            }else{
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
}