import java.util.*;

public class Main{
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] X = new int[N];
		for(int i = 0; i < N; i++) {
			X[i] = sc.nextInt();
		}
		boolean flag = true;
		for(int i = N - 2 ; i >= 0; i--) {
			if(X[i] > X[i + 1]) {
				if(X[i] - X[i + 1] == 1)X[i]--;
				else{
					flag = false;
					break;
				}
			}
		}

		System.out.println((flag)?"Yes":"No");

	}
} import java.util.*; util.* java public class Main{
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] X = new int[N];
		for(int i = 0; i < N; i++) {
			X[i] = sc.nextInt();
		}
		boolean flag = true;
		for(int i = N - 2 ; i >= 0; i--) {
			if(X[i] > X[i + 1]) {
				if(X[i] - X[i + 1] == 1)X[i]--;
				else{
					flag = false;
					break;
				}
			}
		}

		System.out.println((flag)?"Yes":"No");

	}
} Main public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] X = new int[N];
		for(int i = 0; i < N; i++) {
			X[i] = sc.nextInt();
		}
		boolean flag = true;
		for(int i = N - 2 ; i >= 0; i--) {
			if(X[i] > X[i + 1]) {
				if(X[i] - X[i + 1] == 1)X[i]--;
				else{
					flag = false;
					break;
				}
			}
		}

		System.out.println((flag)?"Yes":"No");

	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] X = new int[N];
		for(int i = 0; i < N; i++) {
			X[i] = sc.nextInt();
		}
		boolean flag = true;
		for(int i = N - 2 ; i >= 0; i--) {
			if(X[i] > X[i + 1]) {
				if(X[i] - X[i + 1] == 1)X[i]--;
				else{
					flag = false;
					break;
				}
			}
		}

		System.out.println((flag)?"Yes":"No");

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] X = new int[N]; X new int[N] N for(int i = 0; i < N; i++) {
			X[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			X[i] = sc.nextInt();
		} {
			X[i] = sc.nextInt();
		} X[i] = sc.nextInt() X[i] X i sc.nextInt() sc.nextInt sc boolean flag = true; flag true for(int i = N - 2 ; i >= 0; i--) {
			if(X[i] > X[i + 1]) {
				if(X[i] - X[i + 1] == 1)X[i]--;
				else{
					flag = false;
					break;
				}
			}
		} int i = N - 2 ; int i = N - 2 ; i N - 2 N 2 i >= 0 i 0 i-- i-- i {
			if(X[i] > X[i + 1]) {
				if(X[i] - X[i + 1] == 1)X[i]--;
				else{
					flag = false;
					break;
				}
			}
		} {
			if(X[i] > X[i + 1]) {
				if(X[i] - X[i + 1] == 1)X[i]--;
				else{
					flag = false;
					break;
				}
			}
		} if(X[i] > X[i + 1]) {
				if(X[i] - X[i + 1] == 1)X[i]--;
				else{
					flag = false;
					break;
				}
			} X[i] > X[i + 1] X[i] X i X[i + 1] X i + 1 i 1 {
				if(X[i] - X[i + 1] == 1)X[i]--;
				else{
					flag = false;
					break;
				}
			} if(X[i] - X[i + 1] == 1)X[i]--;
				else{
					flag = false;
					break;
				} X[i] - X[i + 1] == 1 X[i] - X[i + 1] X[i] X i X[i + 1] X i + 1 i 1 1 X[i]-- X[i] X i {
					flag = false;
					break;
				} flag = false flag false break; System.out.println((flag)?"Yes":"No") System.out.println System.out System System.out (flag)?"Yes":"No" (flag) "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[] X = new int[N];
		for(int i = 0; i < N; i++) {
			X[i] = sc.nextInt();
		}
		boolean flag = true;
		for(int i = N - 2 ; i >= 0; i--) {
			if(X[i] > X[i + 1]) {
				if(X[i] - X[i + 1] == 1)X[i]--;
				else{
					flag = false;
					break;
				}
			}
		}

		System.out.println((flag)?"Yes":"No");

	}
} public class Main{
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] X = new int[N];
		for(int i = 0; i < N; i++) {
			X[i] = sc.nextInt();
		}
		boolean flag = true;
		for(int i = N - 2 ; i >= 0; i--) {
			if(X[i] > X[i + 1]) {
				if(X[i] - X[i + 1] == 1)X[i]--;
				else{
					flag = false;
					break;
				}
			}
		}

		System.out.println((flag)?"Yes":"No");

	}
} Main
import java.util.*;

public class Main{
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] X = new int[N];
		for(int i = 0; i < N; i++) {
			X[i] = sc.nextInt();
		}
		boolean flag = true;
		for(int i = N - 2 ; i >= 0; i--) {
			if(X[i] > X[i + 1]) {
				if(X[i] - X[i + 1] == 1)X[i]--;
				else{
					flag = false;
					break;
				}
			}
		}

		System.out.println((flag)?"Yes":"No");

	}
}