import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Main mainObj = new Main();
		mainObj.solve();
	}

	public void solve() {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		String[] heightStrArr = sc.nextLine().split(" ");
		sc.close();
		int[] heightArr = new int[n];
		for(int i = 0; i < n; i++) {
			heightArr[i] = Integer.parseInt(heightStrArr[i]);
		}
		
		
		if(heightArr[0] > 0) {
			heightArr[0] = heightArr[0] - 1;
		}
		for(int i = 1; i < n; i++) {
			if(heightArr[i] > heightArr[i-1]) {
				heightArr[i] = heightArr[i] - 1;
			}
			if(heightArr[i] < heightArr[i-1]) {
				System.out.println("No");
				return;
			}
		}
		
		System.out.println("Yes");
	}
} import java.util.Scanner; Scanner java.util public class Main {
	
	public static void main(String[] args) {
		Main mainObj = new Main();
		mainObj.solve();
	}

	public void solve() {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		String[] heightStrArr = sc.nextLine().split(" ");
		sc.close();
		int[] heightArr = new int[n];
		for(int i = 0; i < n; i++) {
			heightArr[i] = Integer.parseInt(heightStrArr[i]);
		}
		
		
		if(heightArr[0] > 0) {
			heightArr[0] = heightArr[0] - 1;
		}
		for(int i = 1; i < n; i++) {
			if(heightArr[i] > heightArr[i-1]) {
				heightArr[i] = heightArr[i] - 1;
			}
			if(heightArr[i] < heightArr[i-1]) {
				System.out.println("No");
				return;
			}
		}
		
		System.out.println("Yes");
	}
} Main public static void main(String[] args) {
		Main mainObj = new Main();
		mainObj.solve();
	} main {
		Main mainObj = new Main();
		mainObj.solve();
	} Main mainObj = new Main(); mainObj new Main() mainObj.solve() mainObj.solve mainObj String[] args args public void solve() {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		String[] heightStrArr = sc.nextLine().split(" ");
		sc.close();
		int[] heightArr = new int[n];
		for(int i = 0; i < n; i++) {
			heightArr[i] = Integer.parseInt(heightStrArr[i]);
		}
		
		
		if(heightArr[0] > 0) {
			heightArr[0] = heightArr[0] - 1;
		}
		for(int i = 1; i < n; i++) {
			if(heightArr[i] > heightArr[i-1]) {
				heightArr[i] = heightArr[i] - 1;
			}
			if(heightArr[i] < heightArr[i-1]) {
				System.out.println("No");
				return;
			}
		}
		
		System.out.println("Yes");
	} solve {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		String[] heightStrArr = sc.nextLine().split(" ");
		sc.close();
		int[] heightArr = new int[n];
		for(int i = 0; i < n; i++) {
			heightArr[i] = Integer.parseInt(heightStrArr[i]);
		}
		
		
		if(heightArr[0] > 0) {
			heightArr[0] = heightArr[0] - 1;
		}
		for(int i = 1; i < n; i++) {
			if(heightArr[i] > heightArr[i-1]) {
				heightArr[i] = heightArr[i] - 1;
			}
			if(heightArr[i] < heightArr[i-1]) {
				System.out.println("No");
				return;
			}
		}
		
		System.out.println("Yes");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.nextLine()); n Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc String[] heightStrArr = sc.nextLine().split(" "); heightStrArr sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " sc.close() sc.close sc int[] heightArr = new int[n]; heightArr new int[n] n for(int i = 0; i < n; i++) {
			heightArr[i] = Integer.parseInt(heightStrArr[i]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			heightArr[i] = Integer.parseInt(heightStrArr[i]);
		} {
			heightArr[i] = Integer.parseInt(heightStrArr[i]);
		} heightArr[i] = Integer.parseInt(heightStrArr[i]) heightArr[i] heightArr i Integer.parseInt(heightStrArr[i]) Integer.parseInt Integer heightStrArr[i] heightStrArr i if(heightArr[0] > 0) {
			heightArr[0] = heightArr[0] - 1;
		} heightArr[0] > 0 heightArr[0] heightArr 0 0 {
			heightArr[0] = heightArr[0] - 1;
		} heightArr[0] = heightArr[0] - 1 heightArr[0] heightArr 0 heightArr[0] - 1 heightArr[0] heightArr 0 1 for(int i = 1; i < n; i++) {
			if(heightArr[i] > heightArr[i-1]) {
				heightArr[i] = heightArr[i] - 1;
			}
			if(heightArr[i] < heightArr[i-1]) {
				System.out.println("No");
				return;
			}
		} int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
			if(heightArr[i] > heightArr[i-1]) {
				heightArr[i] = heightArr[i] - 1;
			}
			if(heightArr[i] < heightArr[i-1]) {
				System.out.println("No");
				return;
			}
		} {
			if(heightArr[i] > heightArr[i-1]) {
				heightArr[i] = heightArr[i] - 1;
			}
			if(heightArr[i] < heightArr[i-1]) {
				System.out.println("No");
				return;
			}
		} if(heightArr[i] > heightArr[i-1]) {
				heightArr[i] = heightArr[i] - 1;
			} heightArr[i] > heightArr[i-1] heightArr[i] heightArr i heightArr[i-1] heightArr i-1 i 1 {
				heightArr[i] = heightArr[i] - 1;
			} heightArr[i] = heightArr[i] - 1 heightArr[i] heightArr i heightArr[i] - 1 heightArr[i] heightArr i 1 if(heightArr[i] < heightArr[i-1]) {
				System.out.println("No");
				return;
			} heightArr[i] < heightArr[i-1] heightArr[i] heightArr i heightArr[i-1] heightArr i-1 i 1 {
				System.out.println("No");
				return;
			} System.out.println("No") System.out.println System.out System System.out "No" return; System.out.println("Yes") System.out.println System.out System System.out "Yes" public class Main {
	
	public static void main(String[] args) {
		Main mainObj = new Main();
		mainObj.solve();
	}

	public void solve() {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		String[] heightStrArr = sc.nextLine().split(" ");
		sc.close();
		int[] heightArr = new int[n];
		for(int i = 0; i < n; i++) {
			heightArr[i] = Integer.parseInt(heightStrArr[i]);
		}
		
		
		if(heightArr[0] > 0) {
			heightArr[0] = heightArr[0] - 1;
		}
		for(int i = 1; i < n; i++) {
			if(heightArr[i] > heightArr[i-1]) {
				heightArr[i] = heightArr[i] - 1;
			}
			if(heightArr[i] < heightArr[i-1]) {
				System.out.println("No");
				return;
			}
		}
		
		System.out.println("Yes");
	}
} public class Main {
	
	public static void main(String[] args) {
		Main mainObj = new Main();
		mainObj.solve();
	}

	public void solve() {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		String[] heightStrArr = sc.nextLine().split(" ");
		sc.close();
		int[] heightArr = new int[n];
		for(int i = 0; i < n; i++) {
			heightArr[i] = Integer.parseInt(heightStrArr[i]);
		}
		
		
		if(heightArr[0] > 0) {
			heightArr[0] = heightArr[0] - 1;
		}
		for(int i = 1; i < n; i++) {
			if(heightArr[i] > heightArr[i-1]) {
				heightArr[i] = heightArr[i] - 1;
			}
			if(heightArr[i] < heightArr[i-1]) {
				System.out.println("No");
				return;
			}
		}
		
		System.out.println("Yes");
	}
} Main
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Main mainObj = new Main();
		mainObj.solve();
	}

	public void solve() {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		String[] heightStrArr = sc.nextLine().split(" ");
		sc.close();
		int[] heightArr = new int[n];
		for(int i = 0; i < n; i++) {
			heightArr[i] = Integer.parseInt(heightStrArr[i]);
		}
		
		
		if(heightArr[0] > 0) {
			heightArr[0] = heightArr[0] - 1;
		}
		for(int i = 1; i < n; i++) {
			if(heightArr[i] > heightArr[i-1]) {
				heightArr[i] = heightArr[i] - 1;
			}
			if(heightArr[i] < heightArr[i-1]) {
				System.out.println("No");
				return;
			}
		}
		
		System.out.println("Yes");
	}
}