import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] H = new int[N];
        for (int i = 0; i < N; i++){
            H[i] = sc.nextInt();
        }
        if(N==1){
            System.out.println("Yes");
            return;
        } else {
            for(int i = N-2; i >= 0; i--){
                if(H[i] <= H[i+1])
                    continue;
                if(H[i] == H[i+1] + 1)
                    H[i] = H[i] - 1;
                if(H[i] > H[i+1]){
                    System.out.println("No");
                    return;
                }
            }
        }
        System.out.println("Yes");
        sc.close();        
    }
} import java.util.*; util.* java public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] H = new int[N];
        for (int i = 0; i < N; i++){
            H[i] = sc.nextInt();
        }
        if(N==1){
            System.out.println("Yes");
            return;
        } else {
            for(int i = N-2; i >= 0; i--){
                if(H[i] <= H[i+1])
                    continue;
                if(H[i] == H[i+1] + 1)
                    H[i] = H[i] - 1;
                if(H[i] > H[i+1]){
                    System.out.println("No");
                    return;
                }
            }
        }
        System.out.println("Yes");
        sc.close();        
    }
} Main public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] H = new int[N];
        for (int i = 0; i < N; i++){
            H[i] = sc.nextInt();
        }
        if(N==1){
            System.out.println("Yes");
            return;
        } else {
            for(int i = N-2; i >= 0; i--){
                if(H[i] <= H[i+1])
                    continue;
                if(H[i] == H[i+1] + 1)
                    H[i] = H[i] - 1;
                if(H[i] > H[i+1]){
                    System.out.println("No");
                    return;
                }
            }
        }
        System.out.println("Yes");
        sc.close();        
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] H = new int[N];
        for (int i = 0; i < N; i++){
            H[i] = sc.nextInt();
        }
        if(N==1){
            System.out.println("Yes");
            return;
        } else {
            for(int i = N-2; i >= 0; i--){
                if(H[i] <= H[i+1])
                    continue;
                if(H[i] == H[i+1] + 1)
                    H[i] = H[i] - 1;
                if(H[i] > H[i+1]){
                    System.out.println("No");
                    return;
                }
            }
        }
        System.out.println("Yes");
        sc.close();        
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] H = new int[N]; H new int[N] N for (int i = 0; i < N; i++){
            H[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            H[i] = sc.nextInt();
        } {
            H[i] = sc.nextInt();
        } H[i] = sc.nextInt() H[i] H i sc.nextInt() sc.nextInt sc if(N==1){
            System.out.println("Yes");
            return;
        } else {
            for(int i = N-2; i >= 0; i--){
                if(H[i] <= H[i+1])
                    continue;
                if(H[i] == H[i+1] + 1)
                    H[i] = H[i] - 1;
                if(H[i] > H[i+1]){
                    System.out.println("No");
                    return;
                }
            }
        } N==1 N 1 {
            System.out.println("Yes");
            return;
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" return; {
            for(int i = N-2; i >= 0; i--){
                if(H[i] <= H[i+1])
                    continue;
                if(H[i] == H[i+1] + 1)
                    H[i] = H[i] - 1;
                if(H[i] > H[i+1]){
                    System.out.println("No");
                    return;
                }
            }
        } for(int i = N-2; i >= 0; i--){
                if(H[i] <= H[i+1])
                    continue;
                if(H[i] == H[i+1] + 1)
                    H[i] = H[i] - 1;
                if(H[i] > H[i+1]){
                    System.out.println("No");
                    return;
                }
            } int i = N-2; int i = N-2; i N-2 N 2 i >= 0 i 0 i-- i-- i {
                if(H[i] <= H[i+1])
                    continue;
                if(H[i] == H[i+1] + 1)
                    H[i] = H[i] - 1;
                if(H[i] > H[i+1]){
                    System.out.println("No");
                    return;
                }
            } {
                if(H[i] <= H[i+1])
                    continue;
                if(H[i] == H[i+1] + 1)
                    H[i] = H[i] - 1;
                if(H[i] > H[i+1]){
                    System.out.println("No");
                    return;
                }
            } if(H[i] <= H[i+1])
                    continue; H[i] <= H[i+1] H[i] H i H[i+1] H i+1 i 1 continue; if(H[i] == H[i+1] + 1)
                    H[i] = H[i] - 1; H[i] == H[i+1] + 1 H[i] H i H[i+1] + 1 H[i+1] H i+1 i 1 1 H[i] = H[i] - 1 H[i] H i H[i] - 1 H[i] H i 1 if(H[i] > H[i+1]){
                    System.out.println("No");
                    return;
                } H[i] > H[i+1] H[i] H i H[i+1] H i+1 i 1 {
                    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" sc.close() sc.close sc String args[] args public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] H = new int[N];
        for (int i = 0; i < N; i++){
            H[i] = sc.nextInt();
        }
        if(N==1){
            System.out.println("Yes");
            return;
        } else {
            for(int i = N-2; i >= 0; i--){
                if(H[i] <= H[i+1])
                    continue;
                if(H[i] == H[i+1] + 1)
                    H[i] = H[i] - 1;
                if(H[i] > H[i+1]){
                    System.out.println("No");
                    return;
                }
            }
        }
        System.out.println("Yes");
        sc.close();        
    }
} public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] H = new int[N];
        for (int i = 0; i < N; i++){
            H[i] = sc.nextInt();
        }
        if(N==1){
            System.out.println("Yes");
            return;
        } else {
            for(int i = N-2; i >= 0; i--){
                if(H[i] <= H[i+1])
                    continue;
                if(H[i] == H[i+1] + 1)
                    H[i] = H[i] - 1;
                if(H[i] > H[i+1]){
                    System.out.println("No");
                    return;
                }
            }
        }
        System.out.println("Yes");
        sc.close();        
    }
} Main
import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] H = new int[N];
        for (int i = 0; i < N; i++){
            H[i] = sc.nextInt();
        }
        if(N==1){
            System.out.println("Yes");
            return;
        } else {
            for(int i = N-2; i >= 0; i--){
                if(H[i] <= H[i+1])
                    continue;
                if(H[i] == H[i+1] + 1)
                    H[i] = H[i] - 1;
                if(H[i] > H[i+1]){
                    System.out.println("No");
                    return;
                }
            }
        }
        System.out.println("Yes");
        sc.close();        
    }
}
