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 ans = true;
        int v = 0;
        
        long[] h = new long[N];
        h[0] = Long.parseLong(sc.next());
        for(int i = 1; i < N; i++) {
            h[i] = Long.parseLong(sc.next());
        }
        
        for(int i = N-1; i >= 1; i--) {
            if(h[i] >= h[i-1]) {
                continue;
            }else if(h[i] - h[i-1] == -1) {
                h[i-1]--;
            }else {
                ans = false;
                break;
            }
        }
        
        if(ans) {
            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 ans = true;
        int v = 0;
        
        long[] h = new long[N];
        h[0] = Long.parseLong(sc.next());
        for(int i = 1; i < N; i++) {
            h[i] = Long.parseLong(sc.next());
        }
        
        for(int i = N-1; i >= 1; i--) {
            if(h[i] >= h[i-1]) {
                continue;
            }else if(h[i] - h[i-1] == -1) {
                h[i-1]--;
            }else {
                ans = false;
                break;
            }
        }
        
        if(ans) {
            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 ans = true;
        int v = 0;
        
        long[] h = new long[N];
        h[0] = Long.parseLong(sc.next());
        for(int i = 1; i < N; i++) {
            h[i] = Long.parseLong(sc.next());
        }
        
        for(int i = N-1; i >= 1; i--) {
            if(h[i] >= h[i-1]) {
                continue;
            }else if(h[i] - h[i-1] == -1) {
                h[i-1]--;
            }else {
                ans = false;
                break;
            }
        }
        
        if(ans) {
            System.out.println("Yes");
        }else {
            System.out.println("No");
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());

        boolean ans = true;
        int v = 0;
        
        long[] h = new long[N];
        h[0] = Long.parseLong(sc.next());
        for(int i = 1; i < N; i++) {
            h[i] = Long.parseLong(sc.next());
        }
        
        for(int i = N-1; i >= 1; i--) {
            if(h[i] >= h[i-1]) {
                continue;
            }else if(h[i] - h[i-1] == -1) {
                h[i-1]--;
            }else {
                ans = false;
                break;
            }
        }
        
        if(ans) {
            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 ans = true; ans true int v = 0; v 0 long[] h = new long[N]; h new long[N] N h[0] = Long.parseLong(sc.next()) h[0] h 0 Long.parseLong(sc.next()) Long.parseLong Long sc.next() sc.next sc for(int i = 1; i < N; i++) {
            h[i] = Long.parseLong(sc.next());
        } int i = 1; int i = 1; i 1 i < N i N i++ i++ i {
            h[i] = Long.parseLong(sc.next());
        } {
            h[i] = Long.parseLong(sc.next());
        } h[i] = Long.parseLong(sc.next()) h[i] h i Long.parseLong(sc.next()) Long.parseLong Long sc.next() sc.next sc for(int i = N-1; i >= 1; i--) {
            if(h[i] >= h[i-1]) {
                continue;
            }else if(h[i] - h[i-1] == -1) {
                h[i-1]--;
            }else {
                ans = false;
                break;
            }
        } int i = N-1; int i = N-1; i N-1 N 1 i >= 1 i 1 i-- i-- i {
            if(h[i] >= h[i-1]) {
                continue;
            }else if(h[i] - h[i-1] == -1) {
                h[i-1]--;
            }else {
                ans = false;
                break;
            }
        } {
            if(h[i] >= h[i-1]) {
                continue;
            }else if(h[i] - h[i-1] == -1) {
                h[i-1]--;
            }else {
                ans = false;
                break;
            }
        } if(h[i] >= h[i-1]) {
                continue;
            }else if(h[i] - h[i-1] == -1) {
                h[i-1]--;
            }else {
                ans = false;
                break;
            } 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] == -1) {
                h[i-1]--;
            }else {
                ans = false;
                break;
            } h[i] - h[i-1] == -1 h[i] - h[i-1] h[i] h i h[i-1] h i-1 i 1 -1 1 {
                h[i-1]--;
            } h[i-1]-- h[i-1] h i-1 i 1 {
                ans = false;
                break;
            } ans = false ans false break; if(ans) {
            System.out.println("Yes");
        }else {
            System.out.println("No");
        } ans {
            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 ans = true;
        int v = 0;
        
        long[] h = new long[N];
        h[0] = Long.parseLong(sc.next());
        for(int i = 1; i < N; i++) {
            h[i] = Long.parseLong(sc.next());
        }
        
        for(int i = N-1; i >= 1; i--) {
            if(h[i] >= h[i-1]) {
                continue;
            }else if(h[i] - h[i-1] == -1) {
                h[i-1]--;
            }else {
                ans = false;
                break;
            }
        }
        
        if(ans) {
            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 ans = true;
        int v = 0;
        
        long[] h = new long[N];
        h[0] = Long.parseLong(sc.next());
        for(int i = 1; i < N; i++) {
            h[i] = Long.parseLong(sc.next());
        }
        
        for(int i = N-1; i >= 1; i--) {
            if(h[i] >= h[i-1]) {
                continue;
            }else if(h[i] - h[i-1] == -1) {
                h[i-1]--;
            }else {
                ans = false;
                break;
            }
        }
        
        if(ans) {
            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 ans = true;
        int v = 0;
        
        long[] h = new long[N];
        h[0] = Long.parseLong(sc.next());
        for(int i = 1; i < N; i++) {
            h[i] = Long.parseLong(sc.next());
        }
        
        for(int i = N-1; i >= 1; i--) {
            if(h[i] >= h[i-1]) {
                continue;
            }else if(h[i] - h[i-1] == -1) {
                h[i-1]--;
            }else {
                ans = false;
                break;
            }
        }
        
        if(ans) {
            System.out.println("Yes");
        }else {
            System.out.println("No");
        }
    }
}