import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] H = new long[N];
        long rem = 0;
        boolean result = true;
        
        for(int i = 0; i < N; i++){
            H[i] = sc.nextLong();
            if(i == 0)continue;
            if(H[i] < rem - 1){
                result = false;
                break;
            }
            
            if(H[i-1] == H[i] + 1){
                rem = H[i-1];
            }else if(H[i-1] > H[i]){
                result = false;
                break;
            }
            
        }
        if(result){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] H = new long[N];
        long rem = 0;
        boolean result = true;
        
        for(int i = 0; i < N; i++){
            H[i] = sc.nextLong();
            if(i == 0)continue;
            if(H[i] < rem - 1){
                result = false;
                break;
            }
            
            if(H[i-1] == H[i] + 1){
                rem = H[i-1];
            }else if(H[i-1] > H[i]){
                result = false;
                break;
            }
            
        }
        if(result){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] H = new long[N];
        long rem = 0;
        boolean result = true;
        
        for(int i = 0; i < N; i++){
            H[i] = sc.nextLong();
            if(i == 0)continue;
            if(H[i] < rem - 1){
                result = false;
                break;
            }
            
            if(H[i-1] == H[i] + 1){
                rem = H[i-1];
            }else if(H[i-1] > H[i]){
                result = false;
                break;
            }
            
        }
        if(result){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] H = new long[N];
        long rem = 0;
        boolean result = true;
        
        for(int i = 0; i < N; i++){
            H[i] = sc.nextLong();
            if(i == 0)continue;
            if(H[i] < rem - 1){
                result = false;
                break;
            }
            
            if(H[i-1] == H[i] + 1){
                rem = H[i-1];
            }else if(H[i-1] > H[i]){
                result = false;
                break;
            }
            
        }
        if(result){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc long[] H = new long[N]; H new long[N] N long rem = 0; rem 0 boolean result = true; result true for(int i = 0; i < N; i++){
            H[i] = sc.nextLong();
            if(i == 0)continue;
            if(H[i] < rem - 1){
                result = false;
                break;
            }
            
            if(H[i-1] == H[i] + 1){
                rem = H[i-1];
            }else if(H[i-1] > H[i]){
                result = false;
                break;
            }
            
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            H[i] = sc.nextLong();
            if(i == 0)continue;
            if(H[i] < rem - 1){
                result = false;
                break;
            }
            
            if(H[i-1] == H[i] + 1){
                rem = H[i-1];
            }else if(H[i-1] > H[i]){
                result = false;
                break;
            }
            
        } {
            H[i] = sc.nextLong();
            if(i == 0)continue;
            if(H[i] < rem - 1){
                result = false;
                break;
            }
            
            if(H[i-1] == H[i] + 1){
                rem = H[i-1];
            }else if(H[i-1] > H[i]){
                result = false;
                break;
            }
            
        } H[i] = sc.nextLong() H[i] H i sc.nextLong() sc.nextLong sc if(i == 0)continue; i == 0 i 0 continue; if(H[i] < rem - 1){
                result = false;
                break;
            } H[i] < rem - 1 H[i] H i rem - 1 rem 1 {
                result = false;
                break;
            } result = false result false break; if(H[i-1] == H[i] + 1){
                rem = H[i-1];
            }else if(H[i-1] > H[i]){
                result = false;
                break;
            } H[i-1] == H[i] + 1 H[i-1] H i-1 i 1 H[i] + 1 H[i] H i 1 {
                rem = H[i-1];
            } rem = H[i-1] rem H[i-1] H i-1 i 1 if(H[i-1] > H[i]){
                result = false;
                break;
            } H[i-1] > H[i] H[i-1] H i-1 i 1 H[i] H i {
                result = false;
                break;
            } result = false result false break; if(result){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        } result {
            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) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] H = new long[N];
        long rem = 0;
        boolean result = true;
        
        for(int i = 0; i < N; i++){
            H[i] = sc.nextLong();
            if(i == 0)continue;
            if(H[i] < rem - 1){
                result = false;
                break;
            }
            
            if(H[i-1] == H[i] + 1){
                rem = H[i-1];
            }else if(H[i-1] > H[i]){
                result = false;
                break;
            }
            
        }
        if(result){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] H = new long[N];
        long rem = 0;
        boolean result = true;
        
        for(int i = 0; i < N; i++){
            H[i] = sc.nextLong();
            if(i == 0)continue;
            if(H[i] < rem - 1){
                result = false;
                break;
            }
            
            if(H[i-1] == H[i] + 1){
                rem = H[i-1];
            }else if(H[i-1] > H[i]){
                result = false;
                break;
            }
            
        }
        if(result){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] H = new long[N];
        long rem = 0;
        boolean result = true;
        
        for(int i = 0; i < N; i++){
            H[i] = sc.nextLong();
            if(i == 0)continue;
            if(H[i] < rem - 1){
                result = false;
                break;
            }
            
            if(H[i-1] == H[i] + 1){
                rem = H[i-1];
            }else if(H[i-1] > H[i]){
                result = false;
                break;
            }
            
        }
        if(result){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}
