import java.util.Scanner;

public class Main {


	public static void main(String[] args) {
		(new Main()).execute();
	}
	public void execute() {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		long H[] = new long[N] ;
		long max = 0 ;
		boolean ans = true ;
		for(int i = 0 ; i < N ; i ++) {
			H[i]= sc.nextLong();
			if(max < H[i]) {
				max =  H[i];
			}
			if(H[i] < max - 1) {
				ans = false ;
				break ;
			}
		}

		if(ans) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}

} import java.util.Scanner; Scanner java.util public class Main {


	public static void main(String[] args) {
		(new Main()).execute();
	}
	public void execute() {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		long H[] = new long[N] ;
		long max = 0 ;
		boolean ans = true ;
		for(int i = 0 ; i < N ; i ++) {
			H[i]= sc.nextLong();
			if(max < H[i]) {
				max =  H[i];
			}
			if(H[i] < max - 1) {
				ans = false ;
				break ;
			}
		}

		if(ans) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}

} Main public static void main(String[] args) {
		(new Main()).execute();
	} main {
		(new Main()).execute();
	} (new Main()).execute() (new Main()).execute (new Main()) String[] args args public void execute() {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		long H[] = new long[N] ;
		long max = 0 ;
		boolean ans = true ;
		for(int i = 0 ; i < N ; i ++) {
			H[i]= sc.nextLong();
			if(max < H[i]) {
				max =  H[i];
			}
			if(H[i] < max - 1) {
				ans = false ;
				break ;
			}
		}

		if(ans) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	} execute {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		long H[] = new long[N] ;
		long max = 0 ;
		boolean ans = true ;
		for(int i = 0 ; i < N ; i ++) {
			H[i]= sc.nextLong();
			if(max < H[i]) {
				max =  H[i];
			}
			if(H[i] < max - 1) {
				ans = false ;
				break ;
			}
		}

		if(ans) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc long H[] = new long[N] ; H new long[N] N long max = 0 ; max 0 boolean ans = true ; ans true for(int i = 0 ; i < N ; i ++) {
			H[i]= sc.nextLong();
			if(max < H[i]) {
				max =  H[i];
			}
			if(H[i] < max - 1) {
				ans = false ;
				break ;
			}
		} int i = 0 ; int i = 0 ; i 0 i < N i N i ++ i ++ i {
			H[i]= sc.nextLong();
			if(max < H[i]) {
				max =  H[i];
			}
			if(H[i] < max - 1) {
				ans = false ;
				break ;
			}
		} {
			H[i]= sc.nextLong();
			if(max < H[i]) {
				max =  H[i];
			}
			if(H[i] < max - 1) {
				ans = false ;
				break ;
			}
		} H[i]= sc.nextLong() H[i] H i sc.nextLong() sc.nextLong sc if(max < H[i]) {
				max =  H[i];
			} max < H[i] max H[i] H i {
				max =  H[i];
			} max =  H[i] max H[i] H i if(H[i] < max - 1) {
				ans = false ;
				break ;
			} H[i] < max - 1 H[i] H i max - 1 max 1 {
				ans = false ;
				break ;
			} ans = false ans false break ; if(ans) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		} ans {
			System.out.println("Yes");
		} System.out.println("Yes") System.out.println System.out System System.out "Yes" {
			System.out.println("No");
		} System.out.println("No") System.out.println System.out System System.out "No" public class Main {


	public static void main(String[] args) {
		(new Main()).execute();
	}
	public void execute() {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		long H[] = new long[N] ;
		long max = 0 ;
		boolean ans = true ;
		for(int i = 0 ; i < N ; i ++) {
			H[i]= sc.nextLong();
			if(max < H[i]) {
				max =  H[i];
			}
			if(H[i] < max - 1) {
				ans = false ;
				break ;
			}
		}

		if(ans) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}

} public class Main {


	public static void main(String[] args) {
		(new Main()).execute();
	}
	public void execute() {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		long H[] = new long[N] ;
		long max = 0 ;
		boolean ans = true ;
		for(int i = 0 ; i < N ; i ++) {
			H[i]= sc.nextLong();
			if(max < H[i]) {
				max =  H[i];
			}
			if(H[i] < max - 1) {
				ans = false ;
				break ;
			}
		}

		if(ans) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}

} Main
import java.util.Scanner;

public class Main {


	public static void main(String[] args) {
		(new Main()).execute();
	}
	public void execute() {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		long H[] = new long[N] ;
		long max = 0 ;
		boolean ans = true ;
		for(int i = 0 ; i < N ; i ++) {
			H[i]= sc.nextLong();
			if(max < H[i]) {
				max =  H[i];
			}
			if(H[i] < max - 1) {
				ans = false ;
				break ;
			}
		}

		if(ans) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}

}
