import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		
		int n = s.nextInt();
		int a[] = new int [n];
		int aMax = 0;
		
		for(int i = 0; i< n;i++) {
			a[i]= s.nextInt()-1;
		}
		boolean can = true;
		for(int i = 0; i<n-1&&can;i++) {
			if(!(a[i]<a[i+1])) {
				if(!(a[i+1]+1>=a[i])||a[i+1]+1<aMax) {
					can = false;
				}
			}else {
				aMax = a[i+1];
			}
		}
		
		if(can) {
			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 s = new Scanner(System.in);
		
		int n = s.nextInt();
		int a[] = new int [n];
		int aMax = 0;
		
		for(int i = 0; i< n;i++) {
			a[i]= s.nextInt()-1;
		}
		boolean can = true;
		for(int i = 0; i<n-1&&can;i++) {
			if(!(a[i]<a[i+1])) {
				if(!(a[i+1]+1>=a[i])||a[i+1]+1<aMax) {
					can = false;
				}
			}else {
				aMax = a[i+1];
			}
		}
		
		if(can) {
			System.out.println("Yes");
		}else System.out.println("No");
	}

} Main public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		
		int n = s.nextInt();
		int a[] = new int [n];
		int aMax = 0;
		
		for(int i = 0; i< n;i++) {
			a[i]= s.nextInt()-1;
		}
		boolean can = true;
		for(int i = 0; i<n-1&&can;i++) {
			if(!(a[i]<a[i+1])) {
				if(!(a[i+1]+1>=a[i])||a[i+1]+1<aMax) {
					can = false;
				}
			}else {
				aMax = a[i+1];
			}
		}
		
		if(can) {
			System.out.println("Yes");
		}else System.out.println("No");
	} main {
		Scanner s = new Scanner(System.in);
		
		int n = s.nextInt();
		int a[] = new int [n];
		int aMax = 0;
		
		for(int i = 0; i< n;i++) {
			a[i]= s.nextInt()-1;
		}
		boolean can = true;
		for(int i = 0; i<n-1&&can;i++) {
			if(!(a[i]<a[i+1])) {
				if(!(a[i+1]+1>=a[i])||a[i+1]+1<aMax) {
					can = false;
				}
			}else {
				aMax = a[i+1];
			}
		}
		
		if(can) {
			System.out.println("Yes");
		}else System.out.println("No");
	} Scanner s = new Scanner(System.in); s new Scanner(System.in) int n = s.nextInt(); n s.nextInt() s.nextInt s int a[] = new int [n]; a new int [n] n int aMax = 0; aMax 0 for(int i = 0; i< n;i++) {
			a[i]= s.nextInt()-1;
		} int i = 0; int i = 0; i 0 i< n i n i++ i++ i {
			a[i]= s.nextInt()-1;
		} {
			a[i]= s.nextInt()-1;
		} a[i]= s.nextInt()-1 a[i] a i s.nextInt()-1 s.nextInt() s.nextInt s 1 boolean can = true; can true for(int i = 0; i<n-1&&can;i++) {
			if(!(a[i]<a[i+1])) {
				if(!(a[i+1]+1>=a[i])||a[i+1]+1<aMax) {
					can = false;
				}
			}else {
				aMax = a[i+1];
			}
		} int i = 0; int i = 0; i 0 i<n-1&&can i<n-1 i n-1 n 1 can i++ i++ i {
			if(!(a[i]<a[i+1])) {
				if(!(a[i+1]+1>=a[i])||a[i+1]+1<aMax) {
					can = false;
				}
			}else {
				aMax = a[i+1];
			}
		} {
			if(!(a[i]<a[i+1])) {
				if(!(a[i+1]+1>=a[i])||a[i+1]+1<aMax) {
					can = false;
				}
			}else {
				aMax = a[i+1];
			}
		} if(!(a[i]<a[i+1])) {
				if(!(a[i+1]+1>=a[i])||a[i+1]+1<aMax) {
					can = false;
				}
			}else {
				aMax = a[i+1];
			} !(a[i]<a[i+1]) (a[i]<a[i+1]) a[i] a i a[i+1] a i+1 i 1 {
				if(!(a[i+1]+1>=a[i])||a[i+1]+1<aMax) {
					can = false;
				}
			} if(!(a[i+1]+1>=a[i])||a[i+1]+1<aMax) {
					can = false;
				} !(a[i+1]+1>=a[i])||a[i+1]+1<aMax !(a[i+1]+1>=a[i]) (a[i+1]+1>=a[i]) a[i+1]+1 a[i+1] a i+1 i 1 1 a[i] a i a[i+1]+1<aMax a[i+1]+1 a[i+1] a i+1 i 1 1 aMax {
					can = false;
				} can = false can false {
				aMax = a[i+1];
			} aMax = a[i+1] aMax a[i+1] a i+1 i 1 if(can) {
			System.out.println("Yes");
		}else System.out.println("No"); can {
			System.out.println("Yes");
		} System.out.println("Yes") System.out.println System.out System System.out "Yes" 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 s = new Scanner(System.in);
		
		int n = s.nextInt();
		int a[] = new int [n];
		int aMax = 0;
		
		for(int i = 0; i< n;i++) {
			a[i]= s.nextInt()-1;
		}
		boolean can = true;
		for(int i = 0; i<n-1&&can;i++) {
			if(!(a[i]<a[i+1])) {
				if(!(a[i+1]+1>=a[i])||a[i+1]+1<aMax) {
					can = false;
				}
			}else {
				aMax = a[i+1];
			}
		}
		
		if(can) {
			System.out.println("Yes");
		}else System.out.println("No");
	}

} public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		
		int n = s.nextInt();
		int a[] = new int [n];
		int aMax = 0;
		
		for(int i = 0; i< n;i++) {
			a[i]= s.nextInt()-1;
		}
		boolean can = true;
		for(int i = 0; i<n-1&&can;i++) {
			if(!(a[i]<a[i+1])) {
				if(!(a[i+1]+1>=a[i])||a[i+1]+1<aMax) {
					can = false;
				}
			}else {
				aMax = a[i+1];
			}
		}
		
		if(can) {
			System.out.println("Yes");
		}else System.out.println("No");
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		
		int n = s.nextInt();
		int a[] = new int [n];
		int aMax = 0;
		
		for(int i = 0; i< n;i++) {
			a[i]= s.nextInt()-1;
		}
		boolean can = true;
		for(int i = 0; i<n-1&&can;i++) {
			if(!(a[i]<a[i+1])) {
				if(!(a[i+1]+1>=a[i])||a[i+1]+1<aMax) {
					can = false;
				}
			}else {
				aMax = a[i+1];
			}
		}
		
		if(can) {
			System.out.println("Yes");
		}else System.out.println("No");
	}

}