import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int h[] = new int[a];
		for(int k = 0; k < a; k++){
			h[k] = sc.nextInt();
		}
		boolean flg1 = true;
		boolean flg2 = false;

		for(int i = 1; i < a; i++){
			if(h[i] - h[i-1] == -1 && flg2 == false){
				flg2 = true;
			}
			else if(h[i] - h[i-1] == -1 && flg2 == true){
				flg1 = false;
				break;
			}
			else if(h[i] - h[i-1] > 0){
				flg2 = false;
			}
			else if(h[i] - h[i-1] < -1){
				flg1 = false;
				break;
			}
		}

		if(flg1){
			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) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int h[] = new int[a];
		for(int k = 0; k < a; k++){
			h[k] = sc.nextInt();
		}
		boolean flg1 = true;
		boolean flg2 = false;

		for(int i = 1; i < a; i++){
			if(h[i] - h[i-1] == -1 && flg2 == false){
				flg2 = true;
			}
			else if(h[i] - h[i-1] == -1 && flg2 == true){
				flg1 = false;
				break;
			}
			else if(h[i] - h[i-1] > 0){
				flg2 = false;
			}
			else if(h[i] - h[i-1] < -1){
				flg1 = false;
				break;
			}
		}

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

} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int h[] = new int[a];
		for(int k = 0; k < a; k++){
			h[k] = sc.nextInt();
		}
		boolean flg1 = true;
		boolean flg2 = false;

		for(int i = 1; i < a; i++){
			if(h[i] - h[i-1] == -1 && flg2 == false){
				flg2 = true;
			}
			else if(h[i] - h[i-1] == -1 && flg2 == true){
				flg1 = false;
				break;
			}
			else if(h[i] - h[i-1] > 0){
				flg2 = false;
			}
			else if(h[i] - h[i-1] < -1){
				flg1 = false;
				break;
			}
		}

		if(flg1){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}
	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int h[] = new int[a];
		for(int k = 0; k < a; k++){
			h[k] = sc.nextInt();
		}
		boolean flg1 = true;
		boolean flg2 = false;

		for(int i = 1; i < a; i++){
			if(h[i] - h[i-1] == -1 && flg2 == false){
				flg2 = true;
			}
			else if(h[i] - h[i-1] == -1 && flg2 == true){
				flg1 = false;
				break;
			}
			else if(h[i] - h[i-1] > 0){
				flg2 = false;
			}
			else if(h[i] - h[i-1] < -1){
				flg1 = false;
				break;
			}
		}

		if(flg1){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int h[] = new int[a]; h new int[a] a for(int k = 0; k < a; k++){
			h[k] = sc.nextInt();
		} int k = 0; int k = 0; k 0 k < a k a k++ k++ k {
			h[k] = sc.nextInt();
		} {
			h[k] = sc.nextInt();
		} h[k] = sc.nextInt() h[k] h k sc.nextInt() sc.nextInt sc boolean flg1 = true; flg1 true boolean flg2 = false; flg2 false for(int i = 1; i < a; i++){
			if(h[i] - h[i-1] == -1 && flg2 == false){
				flg2 = true;
			}
			else if(h[i] - h[i-1] == -1 && flg2 == true){
				flg1 = false;
				break;
			}
			else if(h[i] - h[i-1] > 0){
				flg2 = false;
			}
			else if(h[i] - h[i-1] < -1){
				flg1 = false;
				break;
			}
		} int i = 1; int i = 1; i 1 i < a i a i++ i++ i {
			if(h[i] - h[i-1] == -1 && flg2 == false){
				flg2 = true;
			}
			else if(h[i] - h[i-1] == -1 && flg2 == true){
				flg1 = false;
				break;
			}
			else if(h[i] - h[i-1] > 0){
				flg2 = false;
			}
			else if(h[i] - h[i-1] < -1){
				flg1 = false;
				break;
			}
		} {
			if(h[i] - h[i-1] == -1 && flg2 == false){
				flg2 = true;
			}
			else if(h[i] - h[i-1] == -1 && flg2 == true){
				flg1 = false;
				break;
			}
			else if(h[i] - h[i-1] > 0){
				flg2 = false;
			}
			else if(h[i] - h[i-1] < -1){
				flg1 = false;
				break;
			}
		} if(h[i] - h[i-1] == -1 && flg2 == false){
				flg2 = true;
			}
			else if(h[i] - h[i-1] == -1 && flg2 == true){
				flg1 = false;
				break;
			}
			else if(h[i] - h[i-1] > 0){
				flg2 = false;
			}
			else if(h[i] - h[i-1] < -1){
				flg1 = false;
				break;
			} h[i] - h[i-1] == -1 && flg2 == false h[i] - h[i-1] == -1 h[i] - h[i-1] h[i] h i h[i-1] h i-1 i 1 -1 1 flg2 == false flg2 false {
				flg2 = true;
			} flg2 = true flg2 true if(h[i] - h[i-1] == -1 && flg2 == true){
				flg1 = false;
				break;
			}
			else if(h[i] - h[i-1] > 0){
				flg2 = false;
			}
			else if(h[i] - h[i-1] < -1){
				flg1 = false;
				break;
			} h[i] - h[i-1] == -1 && flg2 == true h[i] - h[i-1] == -1 h[i] - h[i-1] h[i] h i h[i-1] h i-1 i 1 -1 1 flg2 == true flg2 true {
				flg1 = false;
				break;
			} flg1 = false flg1 false break; if(h[i] - h[i-1] > 0){
				flg2 = false;
			}
			else if(h[i] - h[i-1] < -1){
				flg1 = false;
				break;
			} h[i] - h[i-1] > 0 h[i] - h[i-1] h[i] h i h[i-1] h i-1 i 1 0 {
				flg2 = false;
			} flg2 = false flg2 false if(h[i] - h[i-1] < -1){
				flg1 = false;
				break;
			} h[i] - h[i-1] < -1 h[i] - h[i-1] h[i] h i h[i-1] h i-1 i 1 -1 1 {
				flg1 = false;
				break;
			} flg1 = false flg1 false break; if(flg1){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		} flg1 {
			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) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int h[] = new int[a];
		for(int k = 0; k < a; k++){
			h[k] = sc.nextInt();
		}
		boolean flg1 = true;
		boolean flg2 = false;

		for(int i = 1; i < a; i++){
			if(h[i] - h[i-1] == -1 && flg2 == false){
				flg2 = true;
			}
			else if(h[i] - h[i-1] == -1 && flg2 == true){
				flg1 = false;
				break;
			}
			else if(h[i] - h[i-1] > 0){
				flg2 = false;
			}
			else if(h[i] - h[i-1] < -1){
				flg1 = false;
				break;
			}
		}

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

} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int h[] = new int[a];
		for(int k = 0; k < a; k++){
			h[k] = sc.nextInt();
		}
		boolean flg1 = true;
		boolean flg2 = false;

		for(int i = 1; i < a; i++){
			if(h[i] - h[i-1] == -1 && flg2 == false){
				flg2 = true;
			}
			else if(h[i] - h[i-1] == -1 && flg2 == true){
				flg1 = false;
				break;
			}
			else if(h[i] - h[i-1] > 0){
				flg2 = false;
			}
			else if(h[i] - h[i-1] < -1){
				flg1 = false;
				break;
			}
		}

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

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int h[] = new int[a];
		for(int k = 0; k < a; k++){
			h[k] = sc.nextInt();
		}
		boolean flg1 = true;
		boolean flg2 = false;

		for(int i = 1; i < a; i++){
			if(h[i] - h[i-1] == -1 && flg2 == false){
				flg2 = true;
			}
			else if(h[i] - h[i-1] == -1 && flg2 == true){
				flg1 = false;
				break;
			}
			else if(h[i] - h[i-1] > 0){
				flg2 = false;
			}
			else if(h[i] - h[i-1] < -1){
				flg1 = false;
				break;
			}
		}

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

}