import java.util.*;
 
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] h = new int[n];
        boolean ok = true;
        for(int i = 0; i < n ; i++){
            h[i] = scan.nextInt();
        }
        if(n == 1){
        	System.out.print("Yes");
        }
     	else{
        for(int j = n-1; j > 0; j--){
            if(h[j-1] == h[j] + 1){
                h[j-1] = h[j-1] - 1;
            }
            else if (h[j-1] > h[j] + 1){
                ok = false;
            }
        }
        System.out.print((ok ? "Yes" : "No"));
        }
        scan.close();
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] h = new int[n];
        boolean ok = true;
        for(int i = 0; i < n ; i++){
            h[i] = scan.nextInt();
        }
        if(n == 1){
        	System.out.print("Yes");
        }
     	else{
        for(int j = n-1; j > 0; j--){
            if(h[j-1] == h[j] + 1){
                h[j-1] = h[j-1] - 1;
            }
            else if (h[j-1] > h[j] + 1){
                ok = false;
            }
        }
        System.out.print((ok ? "Yes" : "No"));
        }
        scan.close();
    }
} Main public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] h = new int[n];
        boolean ok = true;
        for(int i = 0; i < n ; i++){
            h[i] = scan.nextInt();
        }
        if(n == 1){
        	System.out.print("Yes");
        }
     	else{
        for(int j = n-1; j > 0; j--){
            if(h[j-1] == h[j] + 1){
                h[j-1] = h[j-1] - 1;
            }
            else if (h[j-1] > h[j] + 1){
                ok = false;
            }
        }
        System.out.print((ok ? "Yes" : "No"));
        }
        scan.close();
    } main {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] h = new int[n];
        boolean ok = true;
        for(int i = 0; i < n ; i++){
            h[i] = scan.nextInt();
        }
        if(n == 1){
        	System.out.print("Yes");
        }
     	else{
        for(int j = n-1; j > 0; j--){
            if(h[j-1] == h[j] + 1){
                h[j-1] = h[j-1] - 1;
            }
            else if (h[j-1] > h[j] + 1){
                ok = false;
            }
        }
        System.out.print((ok ? "Yes" : "No"));
        }
        scan.close();
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int[] h = new int[n]; h new int[n] n boolean ok = true; ok true for(int i = 0; i < n ; i++){
            h[i] = scan.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            h[i] = scan.nextInt();
        } {
            h[i] = scan.nextInt();
        } h[i] = scan.nextInt() h[i] h i scan.nextInt() scan.nextInt scan if(n == 1){
        	System.out.print("Yes");
        }
     	else{
        for(int j = n-1; j > 0; j--){
            if(h[j-1] == h[j] + 1){
                h[j-1] = h[j-1] - 1;
            }
            else if (h[j-1] > h[j] + 1){
                ok = false;
            }
        }
        System.out.print((ok ? "Yes" : "No"));
        } n == 1 n 1 {
        	System.out.print("Yes");
        } System.out.print("Yes") System.out.print System.out System System.out "Yes" {
        for(int j = n-1; j > 0; j--){
            if(h[j-1] == h[j] + 1){
                h[j-1] = h[j-1] - 1;
            }
            else if (h[j-1] > h[j] + 1){
                ok = false;
            }
        }
        System.out.print((ok ? "Yes" : "No"));
        } for(int j = n-1; j > 0; j--){
            if(h[j-1] == h[j] + 1){
                h[j-1] = h[j-1] - 1;
            }
            else if (h[j-1] > h[j] + 1){
                ok = false;
            }
        } int j = n-1; int j = n-1; j n-1 n 1 j > 0 j 0 j-- j-- j {
            if(h[j-1] == h[j] + 1){
                h[j-1] = h[j-1] - 1;
            }
            else if (h[j-1] > h[j] + 1){
                ok = false;
            }
        } {
            if(h[j-1] == h[j] + 1){
                h[j-1] = h[j-1] - 1;
            }
            else if (h[j-1] > h[j] + 1){
                ok = false;
            }
        } if(h[j-1] == h[j] + 1){
                h[j-1] = h[j-1] - 1;
            }
            else if (h[j-1] > h[j] + 1){
                ok = false;
            } h[j-1] == h[j] + 1 h[j-1] h j-1 j 1 h[j] + 1 h[j] h j 1 {
                h[j-1] = h[j-1] - 1;
            } h[j-1] = h[j-1] - 1 h[j-1] h j-1 j 1 h[j-1] - 1 h[j-1] h j-1 j 1 1 if (h[j-1] > h[j] + 1){
                ok = false;
            } h[j-1] > h[j] + 1 h[j-1] h j-1 j 1 h[j] + 1 h[j] h j 1 {
                ok = false;
            } ok = false ok false System.out.print((ok ? "Yes" : "No")) System.out.print System.out System System.out (ok ? "Yes" : "No") ok "Yes" "No" scan.close() scan.close scan String[] args args public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] h = new int[n];
        boolean ok = true;
        for(int i = 0; i < n ; i++){
            h[i] = scan.nextInt();
        }
        if(n == 1){
        	System.out.print("Yes");
        }
     	else{
        for(int j = n-1; j > 0; j--){
            if(h[j-1] == h[j] + 1){
                h[j-1] = h[j-1] - 1;
            }
            else if (h[j-1] > h[j] + 1){
                ok = false;
            }
        }
        System.out.print((ok ? "Yes" : "No"));
        }
        scan.close();
    }
} public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] h = new int[n];
        boolean ok = true;
        for(int i = 0; i < n ; i++){
            h[i] = scan.nextInt();
        }
        if(n == 1){
        	System.out.print("Yes");
        }
     	else{
        for(int j = n-1; j > 0; j--){
            if(h[j-1] == h[j] + 1){
                h[j-1] = h[j-1] - 1;
            }
            else if (h[j-1] > h[j] + 1){
                ok = false;
            }
        }
        System.out.print((ok ? "Yes" : "No"));
        }
        scan.close();
    }
} Main
import java.util.*;
 
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] h = new int[n];
        boolean ok = true;
        for(int i = 0; i < n ; i++){
            h[i] = scan.nextInt();
        }
        if(n == 1){
        	System.out.print("Yes");
        }
     	else{
        for(int j = n-1; j > 0; j--){
            if(h[j-1] == h[j] + 1){
                h[j-1] = h[j-1] - 1;
            }
            else if (h[j-1] > h[j] + 1){
                ok = false;
            }
        }
        System.out.print((ok ? "Yes" : "No"));
        }
        scan.close();
    }
}