import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] H = new int[N];
		for(int i = 0; i < N; i++) {
			H[i] = sc.nextInt();
		}
		sc.close();
		int h = H[0];
		for(int i = 1; i < N; i++) {
			if(h < H[i]) {
				h = --H[i];
			} else if(h > H[i]) {
				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) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] H = new int[N];
		for(int i = 0; i < N; i++) {
			H[i] = sc.nextInt();
		}
		sc.close();
		int h = H[0];
		for(int i = 1; i < N; i++) {
			if(h < H[i]) {
				h = --H[i];
			} else if(h > H[i]) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] H = new int[N];
		for(int i = 0; i < N; i++) {
			H[i] = sc.nextInt();
		}
		sc.close();
		int h = H[0];
		for(int i = 1; i < N; i++) {
			if(h < H[i]) {
				h = --H[i];
			} else if(h > H[i]) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] H = new int[N];
		for(int i = 0; i < N; i++) {
			H[i] = sc.nextInt();
		}
		sc.close();
		int h = H[0];
		for(int i = 1; i < N; i++) {
			if(h < H[i]) {
				h = --H[i];
			} else if(h > H[i]) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] H = new int[N]; H new int[N] N for(int i = 0; i < N; i++) {
			H[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			H[i] = sc.nextInt();
		} {
			H[i] = sc.nextInt();
		} H[i] = sc.nextInt() H[i] H i sc.nextInt() sc.nextInt sc sc.close() sc.close sc int h = H[0]; h H[0] H 0 for(int i = 1; i < N; i++) {
			if(h < H[i]) {
				h = --H[i];
			} else if(h > H[i]) {
				System.out.println("No");
				return;
			}
		} int i = 1; int i = 1; i 1 i < N i N i++ i++ i {
			if(h < H[i]) {
				h = --H[i];
			} else if(h > H[i]) {
				System.out.println("No");
				return;
			}
		} {
			if(h < H[i]) {
				h = --H[i];
			} else if(h > H[i]) {
				System.out.println("No");
				return;
			}
		} if(h < H[i]) {
				h = --H[i];
			} else if(h > H[i]) {
				System.out.println("No");
				return;
			} h < H[i] h H[i] H i {
				h = --H[i];
			} h = --H[i] h --H[i] H[i] H i if(h > H[i]) {
				System.out.println("No");
				return;
			} h > H[i] h H[i] H i {
				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" String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] H = new int[N];
		for(int i = 0; i < N; i++) {
			H[i] = sc.nextInt();
		}
		sc.close();
		int h = H[0];
		for(int i = 1; i < N; i++) {
			if(h < H[i]) {
				h = --H[i];
			} else if(h > H[i]) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] H = new int[N];
		for(int i = 0; i < N; i++) {
			H[i] = sc.nextInt();
		}
		sc.close();
		int h = H[0];
		for(int i = 1; i < N; i++) {
			if(h < H[i]) {
				h = --H[i];
			} else if(h > H[i]) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}
} 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[] H = new int[N];
		for(int i = 0; i < N; i++) {
			H[i] = sc.nextInt();
		}
		sc.close();
		int h = H[0];
		for(int i = 1; i < N; i++) {
			if(h < H[i]) {
				h = --H[i];
			} else if(h > H[i]) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}
}
