import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int nums[] = new int[n];

		for (int i = 0; i < n; i++) {
			nums[i] = sc.nextInt();
		}

		boolean result = true;

		for (int i = 0; i < n; i++) {
			int before = 0;
			if (i != 0) {
				before = nums[i - 1];
			}
			if (nums[i] < before) {
				result = false;
				break;
			}
			if (nums[i] != before) {
				nums[i]--;
			}
		}

		if (result) {
			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) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int nums[] = new int[n];

		for (int i = 0; i < n; i++) {
			nums[i] = sc.nextInt();
		}

		boolean result = true;

		for (int i = 0; i < n; i++) {
			int before = 0;
			if (i != 0) {
				before = nums[i - 1];
			}
			if (nums[i] < before) {
				result = false;
				break;
			}
			if (nums[i] != before) {
				nums[i]--;
			}
		}

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

	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int nums[] = new int[n];

		for (int i = 0; i < n; i++) {
			nums[i] = sc.nextInt();
		}

		boolean result = true;

		for (int i = 0; i < n; i++) {
			int before = 0;
			if (i != 0) {
				before = nums[i - 1];
			}
			if (nums[i] < before) {
				result = false;
				break;
			}
			if (nums[i] != before) {
				nums[i]--;
			}
		}

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

	} main {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int nums[] = new int[n];

		for (int i = 0; i < n; i++) {
			nums[i] = sc.nextInt();
		}

		boolean result = true;

		for (int i = 0; i < n; i++) {
			int before = 0;
			if (i != 0) {
				before = nums[i - 1];
			}
			if (nums[i] < before) {
				result = false;
				break;
			}
			if (nums[i] != before) {
				nums[i]--;
			}
		}

		if (result) {
			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 int nums[] = new int[n]; nums new int[n] n for (int i = 0; i < n; i++) {
			nums[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			nums[i] = sc.nextInt();
		} {
			nums[i] = sc.nextInt();
		} nums[i] = sc.nextInt() nums[i] nums i sc.nextInt() sc.nextInt sc boolean result = true; result true for (int i = 0; i < n; i++) {
			int before = 0;
			if (i != 0) {
				before = nums[i - 1];
			}
			if (nums[i] < before) {
				result = false;
				break;
			}
			if (nums[i] != before) {
				nums[i]--;
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			int before = 0;
			if (i != 0) {
				before = nums[i - 1];
			}
			if (nums[i] < before) {
				result = false;
				break;
			}
			if (nums[i] != before) {
				nums[i]--;
			}
		} {
			int before = 0;
			if (i != 0) {
				before = nums[i - 1];
			}
			if (nums[i] < before) {
				result = false;
				break;
			}
			if (nums[i] != before) {
				nums[i]--;
			}
		} int before = 0; before 0 if (i != 0) {
				before = nums[i - 1];
			} i != 0 i 0 {
				before = nums[i - 1];
			} before = nums[i - 1] before nums[i - 1] nums i - 1 i 1 if (nums[i] < before) {
				result = false;
				break;
			} nums[i] < before nums[i] nums i before {
				result = false;
				break;
			} result = false result false break; if (nums[i] != before) {
				nums[i]--;
			} nums[i] != before nums[i] nums i before {
				nums[i]--;
			} nums[i]-- nums[i] nums i if (result) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		} result {
			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" String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int nums[] = new int[n];

		for (int i = 0; i < n; i++) {
			nums[i] = sc.nextInt();
		}

		boolean result = true;

		for (int i = 0; i < n; i++) {
			int before = 0;
			if (i != 0) {
				before = nums[i - 1];
			}
			if (nums[i] < before) {
				result = false;
				break;
			}
			if (nums[i] != before) {
				nums[i]--;
			}
		}

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

	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int nums[] = new int[n];

		for (int i = 0; i < n; i++) {
			nums[i] = sc.nextInt();
		}

		boolean result = true;

		for (int i = 0; i < n; i++) {
			int before = 0;
			if (i != 0) {
				before = nums[i - 1];
			}
			if (nums[i] < before) {
				result = false;
				break;
			}
			if (nums[i] != before) {
				nums[i]--;
			}
		}

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

	}

} 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 nums[] = new int[n];

		for (int i = 0; i < n; i++) {
			nums[i] = sc.nextInt();
		}

		boolean result = true;

		for (int i = 0; i < n; i++) {
			int before = 0;
			if (i != 0) {
				before = nums[i - 1];
			}
			if (nums[i] < before) {
				result = false;
				break;
			}
			if (nums[i] != before) {
				nums[i]--;
			}
		}

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

	}

}