import java.util.*;

public class Main {
	static boolean [] changed;
	static boolean end = false;
	static int array[];
	static String ans = "Yes";
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		changed = new boolean[n];
		array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
			changed[i] = false;
			}
		while(!end){
			end = solved(n);
		}
		System.out.println(ans);
		
	}
	
	public static boolean solved(int n) {
		boolean check = true;
		for (int i = 0; i < n-1; i++) {
			if(array[i]>array[i+1]){
				check = false;
				if(changed[i]){
					ans = "No";
					return true;
				}else{
					array[i] = array[i]-1;
					changed[i] = true;
				}
			}
		}
		return check;
	}
} import java.util.*; util.* java public class Main {
	static boolean [] changed;
	static boolean end = false;
	static int array[];
	static String ans = "Yes";
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		changed = new boolean[n];
		array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
			changed[i] = false;
			}
		while(!end){
			end = solved(n);
		}
		System.out.println(ans);
		
	}
	
	public static boolean solved(int n) {
		boolean check = true;
		for (int i = 0; i < n-1; i++) {
			if(array[i]>array[i+1]){
				check = false;
				if(changed[i]){
					ans = "No";
					return true;
				}else{
					array[i] = array[i]-1;
					changed[i] = true;
				}
			}
		}
		return check;
	}
} Main static boolean [] changed; changed static boolean end = false; end false static int array[]; array static String ans = "Yes"; ans "Yes" public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		changed = new boolean[n];
		array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
			changed[i] = false;
			}
		while(!end){
			end = solved(n);
		}
		System.out.println(ans);
		
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		changed = new boolean[n];
		array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
			changed[i] = false;
			}
		while(!end){
			end = solved(n);
		}
		System.out.println(ans);
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc changed = new boolean[n] changed new boolean[n] n array = new int[n] array new int[n] n for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
			changed[i] = false;
			} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			array[i] = sc.nextInt();
			changed[i] = false;
			} {
			array[i] = sc.nextInt();
			changed[i] = false;
			} array[i] = sc.nextInt() array[i] array i sc.nextInt() sc.nextInt sc changed[i] = false changed[i] changed i false while(!end){
			end = solved(n);
		} !end end {
			end = solved(n);
		} end = solved(n) end solved(n) solved n System.out.println(ans) System.out.println System.out System System.out ans String[] args args public static boolean solved(int n) {
		boolean check = true;
		for (int i = 0; i < n-1; i++) {
			if(array[i]>array[i+1]){
				check = false;
				if(changed[i]){
					ans = "No";
					return true;
				}else{
					array[i] = array[i]-1;
					changed[i] = true;
				}
			}
		}
		return check;
	} solved {
		boolean check = true;
		for (int i = 0; i < n-1; i++) {
			if(array[i]>array[i+1]){
				check = false;
				if(changed[i]){
					ans = "No";
					return true;
				}else{
					array[i] = array[i]-1;
					changed[i] = true;
				}
			}
		}
		return check;
	} boolean check = true; check true for (int i = 0; i < n-1; i++) {
			if(array[i]>array[i+1]){
				check = false;
				if(changed[i]){
					ans = "No";
					return true;
				}else{
					array[i] = array[i]-1;
					changed[i] = true;
				}
			}
		} int i = 0; int i = 0; i 0 i < n-1 i n-1 n 1 i++ i++ i {
			if(array[i]>array[i+1]){
				check = false;
				if(changed[i]){
					ans = "No";
					return true;
				}else{
					array[i] = array[i]-1;
					changed[i] = true;
				}
			}
		} {
			if(array[i]>array[i+1]){
				check = false;
				if(changed[i]){
					ans = "No";
					return true;
				}else{
					array[i] = array[i]-1;
					changed[i] = true;
				}
			}
		} if(array[i]>array[i+1]){
				check = false;
				if(changed[i]){
					ans = "No";
					return true;
				}else{
					array[i] = array[i]-1;
					changed[i] = true;
				}
			} array[i]>array[i+1] array[i] array i array[i+1] array i+1 i 1 {
				check = false;
				if(changed[i]){
					ans = "No";
					return true;
				}else{
					array[i] = array[i]-1;
					changed[i] = true;
				}
			} check = false check false if(changed[i]){
					ans = "No";
					return true;
				}else{
					array[i] = array[i]-1;
					changed[i] = true;
				} changed[i] changed i {
					ans = "No";
					return true;
				} ans = "No" ans "No" return true; true {
					array[i] = array[i]-1;
					changed[i] = true;
				} array[i] = array[i]-1 array[i] array i array[i]-1 array[i] array i 1 changed[i] = true changed[i] changed i true return check; check int n n public class Main {
	static boolean [] changed;
	static boolean end = false;
	static int array[];
	static String ans = "Yes";
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		changed = new boolean[n];
		array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
			changed[i] = false;
			}
		while(!end){
			end = solved(n);
		}
		System.out.println(ans);
		
	}
	
	public static boolean solved(int n) {
		boolean check = true;
		for (int i = 0; i < n-1; i++) {
			if(array[i]>array[i+1]){
				check = false;
				if(changed[i]){
					ans = "No";
					return true;
				}else{
					array[i] = array[i]-1;
					changed[i] = true;
				}
			}
		}
		return check;
	}
} public class Main {
	static boolean [] changed;
	static boolean end = false;
	static int array[];
	static String ans = "Yes";
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		changed = new boolean[n];
		array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
			changed[i] = false;
			}
		while(!end){
			end = solved(n);
		}
		System.out.println(ans);
		
	}
	
	public static boolean solved(int n) {
		boolean check = true;
		for (int i = 0; i < n-1; i++) {
			if(array[i]>array[i+1]){
				check = false;
				if(changed[i]){
					ans = "No";
					return true;
				}else{
					array[i] = array[i]-1;
					changed[i] = true;
				}
			}
		}
		return check;
	}
} Main
import java.util.*;

public class Main {
	static boolean [] changed;
	static boolean end = false;
	static int array[];
	static String ans = "Yes";
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		changed = new boolean[n];
		array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
			changed[i] = false;
			}
		while(!end){
			end = solved(n);
		}
		System.out.println(ans);
		
	}
	
	public static boolean solved(int n) {
		boolean check = true;
		for (int i = 0; i < n-1; i++) {
			if(array[i]>array[i+1]){
				check = false;
				if(changed[i]){
					ans = "No";
					return true;
				}else{
					array[i] = array[i]-1;
					changed[i] = true;
				}
			}
		}
		return check;
	}
}
