import java.util.ArrayList;
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		ArrayList<Integer> numList = new ArrayList<>();
		String ans = "Yes";
		
		for(int i = 1; i <= n; i++) {
			numList.add(sc.nextInt());
		}
		
		int max = numList.get(0) - 1;
		for(int i = 1; i < numList.size(); i++) {
			if(max < numList.get(i)){
				max = numList.get(i) - 1;
			}else if(max == numList.get(i)){
				max = numList.get(i);
			}else {
				ans = "No";
				break;
			}
		}
		
		System.out.println(ans);
		sc.close();
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		ArrayList<Integer> numList = new ArrayList<>();
		String ans = "Yes";
		
		for(int i = 1; i <= n; i++) {
			numList.add(sc.nextInt());
		}
		
		int max = numList.get(0) - 1;
		for(int i = 1; i < numList.size(); i++) {
			if(max < numList.get(i)){
				max = numList.get(i) - 1;
			}else if(max == numList.get(i)){
				max = numList.get(i);
			}else {
				ans = "No";
				break;
			}
		}
		
		System.out.println(ans);
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		ArrayList<Integer> numList = new ArrayList<>();
		String ans = "Yes";
		
		for(int i = 1; i <= n; i++) {
			numList.add(sc.nextInt());
		}
		
		int max = numList.get(0) - 1;
		for(int i = 1; i < numList.size(); i++) {
			if(max < numList.get(i)){
				max = numList.get(i) - 1;
			}else if(max == numList.get(i)){
				max = numList.get(i);
			}else {
				ans = "No";
				break;
			}
		}
		
		System.out.println(ans);
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		ArrayList<Integer> numList = new ArrayList<>();
		String ans = "Yes";
		
		for(int i = 1; i <= n; i++) {
			numList.add(sc.nextInt());
		}
		
		int max = numList.get(0) - 1;
		for(int i = 1; i < numList.size(); i++) {
			if(max < numList.get(i)){
				max = numList.get(i) - 1;
			}else if(max == numList.get(i)){
				max = numList.get(i);
			}else {
				ans = "No";
				break;
			}
		}
		
		System.out.println(ans);
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc ArrayList<Integer> numList = new ArrayList<>(); numList new ArrayList<>() String ans = "Yes"; ans "Yes" for(int i = 1; i <= n; i++) {
			numList.add(sc.nextInt());
		} int i = 1; int i = 1; i 1 i <= n i n i++ i++ i {
			numList.add(sc.nextInt());
		} {
			numList.add(sc.nextInt());
		} numList.add(sc.nextInt()) numList.add numList sc.nextInt() sc.nextInt sc int max = numList.get(0) - 1; max numList.get(0) - 1 numList.get(0) numList.get numList 0 1 for(int i = 1; i < numList.size(); i++) {
			if(max < numList.get(i)){
				max = numList.get(i) - 1;
			}else if(max == numList.get(i)){
				max = numList.get(i);
			}else {
				ans = "No";
				break;
			}
		} int i = 1; int i = 1; i 1 i < numList.size() i numList.size() numList.size numList i++ i++ i {
			if(max < numList.get(i)){
				max = numList.get(i) - 1;
			}else if(max == numList.get(i)){
				max = numList.get(i);
			}else {
				ans = "No";
				break;
			}
		} {
			if(max < numList.get(i)){
				max = numList.get(i) - 1;
			}else if(max == numList.get(i)){
				max = numList.get(i);
			}else {
				ans = "No";
				break;
			}
		} if(max < numList.get(i)){
				max = numList.get(i) - 1;
			}else if(max == numList.get(i)){
				max = numList.get(i);
			}else {
				ans = "No";
				break;
			} max < numList.get(i) max numList.get(i) numList.get numList i {
				max = numList.get(i) - 1;
			} max = numList.get(i) - 1 max numList.get(i) - 1 numList.get(i) numList.get numList i 1 if(max == numList.get(i)){
				max = numList.get(i);
			}else {
				ans = "No";
				break;
			} max == numList.get(i) max numList.get(i) numList.get numList i {
				max = numList.get(i);
			} max = numList.get(i) max numList.get(i) numList.get numList i {
				ans = "No";
				break;
			} ans = "No" ans "No" break; System.out.println(ans) System.out.println System.out System System.out ans 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();
		ArrayList<Integer> numList = new ArrayList<>();
		String ans = "Yes";
		
		for(int i = 1; i <= n; i++) {
			numList.add(sc.nextInt());
		}
		
		int max = numList.get(0) - 1;
		for(int i = 1; i < numList.size(); i++) {
			if(max < numList.get(i)){
				max = numList.get(i) - 1;
			}else if(max == numList.get(i)){
				max = numList.get(i);
			}else {
				ans = "No";
				break;
			}
		}
		
		System.out.println(ans);
		sc.close();
	}
} public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		ArrayList<Integer> numList = new ArrayList<>();
		String ans = "Yes";
		
		for(int i = 1; i <= n; i++) {
			numList.add(sc.nextInt());
		}
		
		int max = numList.get(0) - 1;
		for(int i = 1; i < numList.size(); i++) {
			if(max < numList.get(i)){
				max = numList.get(i) - 1;
			}else if(max == numList.get(i)){
				max = numList.get(i);
			}else {
				ans = "No";
				break;
			}
		}
		
		System.out.println(ans);
		sc.close();
	}
} Main
import java.util.ArrayList;
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		ArrayList<Integer> numList = new ArrayList<>();
		String ans = "Yes";
		
		for(int i = 1; i <= n; i++) {
			numList.add(sc.nextInt());
		}
		
		int max = numList.get(0) - 1;
		for(int i = 1; i < numList.size(); i++) {
			if(max < numList.get(i)){
				max = numList.get(i) - 1;
			}else if(max == numList.get(i)){
				max = numList.get(i);
			}else {
				ans = "No";
				break;
			}
		}
		
		System.out.println(ans);
		sc.close();
	}
}