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<H.length; i++) H[i] = sc.nextInt();

		boolean isOK = true;
		for(int i=N-1; i>0; i--) {
			int now = H[i];
			int next = H[i-1];

			H[i-1] = next-now == 1 ? next-1 : next;

			if(H[i-1]-now > 0) {
				isOK = false;
			}
		}

		System.out.println((isOK ? "Yes" : "No"));
		sc.close();
	}
} 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<H.length; i++) H[i] = sc.nextInt();

		boolean isOK = true;
		for(int i=N-1; i>0; i--) {
			int now = H[i];
			int next = H[i-1];

			H[i-1] = next-now == 1 ? next-1 : next;

			if(H[i-1]-now > 0) {
				isOK = false;
			}
		}

		System.out.println((isOK ? "Yes" : "No"));
		sc.close();
	}
} 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<H.length; i++) H[i] = sc.nextInt();

		boolean isOK = true;
		for(int i=N-1; i>0; i--) {
			int now = H[i];
			int next = H[i-1];

			H[i-1] = next-now == 1 ? next-1 : next;

			if(H[i-1]-now > 0) {
				isOK = false;
			}
		}

		System.out.println((isOK ? "Yes" : "No"));
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		int[] H = new int[N];

		for(int i=0; i<H.length; i++) H[i] = sc.nextInt();

		boolean isOK = true;
		for(int i=N-1; i>0; i--) {
			int now = H[i];
			int next = H[i-1];

			H[i-1] = next-now == 1 ? next-1 : next;

			if(H[i-1]-now > 0) {
				isOK = false;
			}
		}

		System.out.println((isOK ? "Yes" : "No"));
		sc.close();
	} 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<H.length; i++) H[i] = sc.nextInt(); int i=0; int i=0; i 0 i<H.length i H.length H H.length i++ i++ i H[i] = sc.nextInt(); H[i] = sc.nextInt() H[i] H i sc.nextInt() sc.nextInt sc boolean isOK = true; isOK true for(int i=N-1; i>0; i--) {
			int now = H[i];
			int next = H[i-1];

			H[i-1] = next-now == 1 ? next-1 : next;

			if(H[i-1]-now > 0) {
				isOK = false;
			}
		} int i=N-1; int i=N-1; i N-1 N 1 i>0 i 0 i-- i-- i {
			int now = H[i];
			int next = H[i-1];

			H[i-1] = next-now == 1 ? next-1 : next;

			if(H[i-1]-now > 0) {
				isOK = false;
			}
		} {
			int now = H[i];
			int next = H[i-1];

			H[i-1] = next-now == 1 ? next-1 : next;

			if(H[i-1]-now > 0) {
				isOK = false;
			}
		} int now = H[i]; now H[i] H i int next = H[i-1]; next H[i-1] H i-1 i 1 H[i-1] = next-now == 1 ? next-1 : next H[i-1] H i-1 i 1 next-now == 1 ? next-1 : next next-now == 1 next-now next now 1 next-1 next 1 next if(H[i-1]-now > 0) {
				isOK = false;
			} H[i-1]-now > 0 H[i-1]-now H[i-1] H i-1 i 1 now 0 {
				isOK = false;
			} isOK = false isOK false System.out.println((isOK ? "Yes" : "No")) System.out.println System.out System System.out (isOK ? "Yes" : "No") isOK "Yes" "No" sc.close() sc.close sc 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<H.length; i++) H[i] = sc.nextInt();

		boolean isOK = true;
		for(int i=N-1; i>0; i--) {
			int now = H[i];
			int next = H[i-1];

			H[i-1] = next-now == 1 ? next-1 : next;

			if(H[i-1]-now > 0) {
				isOK = false;
			}
		}

		System.out.println((isOK ? "Yes" : "No"));
		sc.close();
	}
} 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<H.length; i++) H[i] = sc.nextInt();

		boolean isOK = true;
		for(int i=N-1; i>0; i--) {
			int now = H[i];
			int next = H[i-1];

			H[i-1] = next-now == 1 ? next-1 : next;

			if(H[i-1]-now > 0) {
				isOK = false;
			}
		}

		System.out.println((isOK ? "Yes" : "No"));
		sc.close();
	}
} 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<H.length; i++) H[i] = sc.nextInt();

		boolean isOK = true;
		for(int i=N-1; i>0; i--) {
			int now = H[i];
			int next = H[i-1];

			H[i-1] = next-now == 1 ? next-1 : next;

			if(H[i-1]-now > 0) {
				isOK = false;
			}
		}

		System.out.println((isOK ? "Yes" : "No"));
		sc.close();
	}
}
