
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] ary = new int[n];
		for(int i = 0; i < n; i++){
			ary[i] = sc.nextInt();
		}
		boolean can = true;
		boolean down1 = true;
		for(int i = 1; i < n; i++){
			int now = ary[i];
			int before = ary[i - 1];
			if(down1){
				before--;
			}
			if(before < now){
				down1 = true;
				continue;
			}
			if(before == now){
				down1 = false;
				continue;
			}
			if(before > now){
				can = false;
				break;
			}
		}
		System.out.println(can ? "Yes" : "No");
	}
} 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();
		int[] ary = new int[n];
		for(int i = 0; i < n; i++){
			ary[i] = sc.nextInt();
		}
		boolean can = true;
		boolean down1 = true;
		for(int i = 1; i < n; i++){
			int now = ary[i];
			int before = ary[i - 1];
			if(down1){
				before--;
			}
			if(before < now){
				down1 = true;
				continue;
			}
			if(before == now){
				down1 = false;
				continue;
			}
			if(before > now){
				can = false;
				break;
			}
		}
		System.out.println(can ? "Yes" : "No");
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] ary = new int[n];
		for(int i = 0; i < n; i++){
			ary[i] = sc.nextInt();
		}
		boolean can = true;
		boolean down1 = true;
		for(int i = 1; i < n; i++){
			int now = ary[i];
			int before = ary[i - 1];
			if(down1){
				before--;
			}
			if(before < now){
				down1 = true;
				continue;
			}
			if(before == now){
				down1 = false;
				continue;
			}
			if(before > now){
				can = false;
				break;
			}
		}
		System.out.println(can ? "Yes" : "No");
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] ary = new int[n];
		for(int i = 0; i < n; i++){
			ary[i] = sc.nextInt();
		}
		boolean can = true;
		boolean down1 = true;
		for(int i = 1; i < n; i++){
			int now = ary[i];
			int before = ary[i - 1];
			if(down1){
				before--;
			}
			if(before < now){
				down1 = true;
				continue;
			}
			if(before == now){
				down1 = false;
				continue;
			}
			if(before > now){
				can = false;
				break;
			}
		}
		System.out.println(can ? "Yes" : "No");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] ary = new int[n]; ary new int[n] n for(int i = 0; i < n; i++){
			ary[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			ary[i] = sc.nextInt();
		} {
			ary[i] = sc.nextInt();
		} ary[i] = sc.nextInt() ary[i] ary i sc.nextInt() sc.nextInt sc boolean can = true; can true boolean down1 = true; down1 true for(int i = 1; i < n; i++){
			int now = ary[i];
			int before = ary[i - 1];
			if(down1){
				before--;
			}
			if(before < now){
				down1 = true;
				continue;
			}
			if(before == now){
				down1 = false;
				continue;
			}
			if(before > now){
				can = false;
				break;
			}
		} int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
			int now = ary[i];
			int before = ary[i - 1];
			if(down1){
				before--;
			}
			if(before < now){
				down1 = true;
				continue;
			}
			if(before == now){
				down1 = false;
				continue;
			}
			if(before > now){
				can = false;
				break;
			}
		} {
			int now = ary[i];
			int before = ary[i - 1];
			if(down1){
				before--;
			}
			if(before < now){
				down1 = true;
				continue;
			}
			if(before == now){
				down1 = false;
				continue;
			}
			if(before > now){
				can = false;
				break;
			}
		} int now = ary[i]; now ary[i] ary i int before = ary[i - 1]; before ary[i - 1] ary i - 1 i 1 if(down1){
				before--;
			} down1 {
				before--;
			} before-- before if(before < now){
				down1 = true;
				continue;
			} before < now before now {
				down1 = true;
				continue;
			} down1 = true down1 true continue; if(before == now){
				down1 = false;
				continue;
			} before == now before now {
				down1 = false;
				continue;
			} down1 = false down1 false continue; if(before > now){
				can = false;
				break;
			} before > now before now {
				can = false;
				break;
			} can = false can false break; System.out.println(can ? "Yes" : "No") System.out.println System.out System System.out can ? "Yes" : "No" can "Yes" "No" String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] ary = new int[n];
		for(int i = 0; i < n; i++){
			ary[i] = sc.nextInt();
		}
		boolean can = true;
		boolean down1 = true;
		for(int i = 1; i < n; i++){
			int now = ary[i];
			int before = ary[i - 1];
			if(down1){
				before--;
			}
			if(before < now){
				down1 = true;
				continue;
			}
			if(before == now){
				down1 = false;
				continue;
			}
			if(before > now){
				can = false;
				break;
			}
		}
		System.out.println(can ? "Yes" : "No");
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] ary = new int[n];
		for(int i = 0; i < n; i++){
			ary[i] = sc.nextInt();
		}
		boolean can = true;
		boolean down1 = true;
		for(int i = 1; i < n; i++){
			int now = ary[i];
			int before = ary[i - 1];
			if(down1){
				before--;
			}
			if(before < now){
				down1 = true;
				continue;
			}
			if(before == now){
				down1 = false;
				continue;
			}
			if(before > now){
				can = false;
				break;
			}
		}
		System.out.println(can ? "Yes" : "No");
	}
} Main

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] ary = new int[n];
		for(int i = 0; i < n; i++){
			ary[i] = sc.nextInt();
		}
		boolean can = true;
		boolean down1 = true;
		for(int i = 1; i < n; i++){
			int now = ary[i];
			int before = ary[i - 1];
			if(down1){
				before--;
			}
			if(before < now){
				down1 = true;
				continue;
			}
			if(before == now){
				down1 = false;
				continue;
			}
			if(before > now){
				can = false;
				break;
			}
		}
		System.out.println(can ? "Yes" : "No");
	}
}
