import java.util.Scanner;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) {
       
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int[] array = new int[a];
        for(int i = 0; i < a; i++){
            array[i] = sc.nextInt();
        }
        int i;
        for(i = 0; i < a - 1; i++){
            if(array[i] == array[i + 1]){
                continue;
            }else if(array[i] > (array[i + 1])){
                array[i + 1] += 1;
                if(array[i] > array[i + 1]){
                    System.out.println("No");
                    break;
                }
            }
        }
        if(i == (a -1)){
            System.out.println("Yes");
        }
    }
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util public class Main {

	public static void main(String[] args) {
       
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int[] array = new int[a];
        for(int i = 0; i < a; i++){
            array[i] = sc.nextInt();
        }
        int i;
        for(i = 0; i < a - 1; i++){
            if(array[i] == array[i + 1]){
                continue;
            }else if(array[i] > (array[i + 1])){
                array[i + 1] += 1;
                if(array[i] > array[i + 1]){
                    System.out.println("No");
                    break;
                }
            }
        }
        if(i == (a -1)){
            System.out.println("Yes");
        }
    }
} Main public static void main(String[] args) {
       
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int[] array = new int[a];
        for(int i = 0; i < a; i++){
            array[i] = sc.nextInt();
        }
        int i;
        for(i = 0; i < a - 1; i++){
            if(array[i] == array[i + 1]){
                continue;
            }else if(array[i] > (array[i + 1])){
                array[i + 1] += 1;
                if(array[i] > array[i + 1]){
                    System.out.println("No");
                    break;
                }
            }
        }
        if(i == (a -1)){
            System.out.println("Yes");
        }
    } main {
       
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int[] array = new int[a];
        for(int i = 0; i < a; i++){
            array[i] = sc.nextInt();
        }
        int i;
        for(i = 0; i < a - 1; i++){
            if(array[i] == array[i + 1]){
                continue;
            }else if(array[i] > (array[i + 1])){
                array[i + 1] += 1;
                if(array[i] > array[i + 1]){
                    System.out.println("No");
                    break;
                }
            }
        }
        if(i == (a -1)){
            System.out.println("Yes");
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int[] array = new int[a]; array new int[a] a for(int i = 0; i < a; i++){
            array[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < a i a i++ i++ i {
            array[i] = sc.nextInt();
        } {
            array[i] = sc.nextInt();
        } array[i] = sc.nextInt() array[i] array i sc.nextInt() sc.nextInt sc int i; i for(i = 0; i < a - 1; i++){
            if(array[i] == array[i + 1]){
                continue;
            }else if(array[i] > (array[i + 1])){
                array[i + 1] += 1;
                if(array[i] > array[i + 1]){
                    System.out.println("No");
                    break;
                }
            }
        } i = 0; i = 0 i 0 i < a - 1 i a - 1 a 1 i++ i++ i {
            if(array[i] == array[i + 1]){
                continue;
            }else if(array[i] > (array[i + 1])){
                array[i + 1] += 1;
                if(array[i] > array[i + 1]){
                    System.out.println("No");
                    break;
                }
            }
        } {
            if(array[i] == array[i + 1]){
                continue;
            }else if(array[i] > (array[i + 1])){
                array[i + 1] += 1;
                if(array[i] > array[i + 1]){
                    System.out.println("No");
                    break;
                }
            }
        } if(array[i] == array[i + 1]){
                continue;
            }else if(array[i] > (array[i + 1])){
                array[i + 1] += 1;
                if(array[i] > array[i + 1]){
                    System.out.println("No");
                    break;
                }
            } array[i] == array[i + 1] array[i] array i array[i + 1] array i + 1 i 1 {
                continue;
            } continue; if(array[i] > (array[i + 1])){
                array[i + 1] += 1;
                if(array[i] > array[i + 1]){
                    System.out.println("No");
                    break;
                }
            } array[i] > (array[i + 1]) array[i] array i (array[i + 1]) array i + 1 i 1 {
                array[i + 1] += 1;
                if(array[i] > array[i + 1]){
                    System.out.println("No");
                    break;
                }
            } array[i + 1] += 1 array[i + 1] array i + 1 i 1 1 if(array[i] > array[i + 1]){
                    System.out.println("No");
                    break;
                } array[i] > array[i + 1] array[i] array i array[i + 1] array i + 1 i 1 {
                    System.out.println("No");
                    break;
                } System.out.println("No") System.out.println System.out System System.out "No" break; if(i == (a -1)){
            System.out.println("Yes");
        } i == (a -1) i (a -1) a 1 {
            System.out.println("Yes");
        } 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 a = sc.nextInt();
        int[] array = new int[a];
        for(int i = 0; i < a; i++){
            array[i] = sc.nextInt();
        }
        int i;
        for(i = 0; i < a - 1; i++){
            if(array[i] == array[i + 1]){
                continue;
            }else if(array[i] > (array[i + 1])){
                array[i + 1] += 1;
                if(array[i] > array[i + 1]){
                    System.out.println("No");
                    break;
                }
            }
        }
        if(i == (a -1)){
            System.out.println("Yes");
        }
    }
} public class Main {

	public static void main(String[] args) {
       
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int[] array = new int[a];
        for(int i = 0; i < a; i++){
            array[i] = sc.nextInt();
        }
        int i;
        for(i = 0; i < a - 1; i++){
            if(array[i] == array[i + 1]){
                continue;
            }else if(array[i] > (array[i + 1])){
                array[i + 1] += 1;
                if(array[i] > array[i + 1]){
                    System.out.println("No");
                    break;
                }
            }
        }
        if(i == (a -1)){
            System.out.println("Yes");
        }
    }
} Main
import java.util.Scanner;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) {
       
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int[] array = new int[a];
        for(int i = 0; i < a; i++){
            array[i] = sc.nextInt();
        }
        int i;
        for(i = 0; i < a - 1; i++){
            if(array[i] == array[i + 1]){
                continue;
            }else if(array[i] > (array[i + 1])){
                array[i + 1] += 1;
                if(array[i] > array[i + 1]){
                    System.out.println("No");
                    break;
                }
            }
        }
        if(i == (a -1)){
            System.out.println("Yes");
        }
    }
}
