import java.util.*;
public class Main{
static int N= 0;

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		N =sc.nextInt();
		int data[] =new int[N];
		int max=0;
		for(int i=0;i<N;i++) {
			data[i] = sc.nextInt();
			if(data[i]> max) max=data[i];
			if(i!=0&& data[i]<max-1) {
				System.out.print("No");
				break;
			}
			if(i==N-1)System.out.print("Yes");

		}
		
		
}
} import java.util.*; util.* java public class Main{
static int N= 0;

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		N =sc.nextInt();
		int data[] =new int[N];
		int max=0;
		for(int i=0;i<N;i++) {
			data[i] = sc.nextInt();
			if(data[i]> max) max=data[i];
			if(i!=0&& data[i]<max-1) {
				System.out.print("No");
				break;
			}
			if(i==N-1)System.out.print("Yes");

		}
		
		
}
} Main static int N= 0; N 0 public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		N =sc.nextInt();
		int data[] =new int[N];
		int max=0;
		for(int i=0;i<N;i++) {
			data[i] = sc.nextInt();
			if(data[i]> max) max=data[i];
			if(i!=0&& data[i]<max-1) {
				System.out.print("No");
				break;
			}
			if(i==N-1)System.out.print("Yes");

		}
		
		
} main {
		Scanner sc = new Scanner(System.in);
		N =sc.nextInt();
		int data[] =new int[N];
		int max=0;
		for(int i=0;i<N;i++) {
			data[i] = sc.nextInt();
			if(data[i]> max) max=data[i];
			if(i!=0&& data[i]<max-1) {
				System.out.print("No");
				break;
			}
			if(i==N-1)System.out.print("Yes");

		}
		
		
} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) N =sc.nextInt() N sc.nextInt() sc.nextInt sc int data[] =new int[N]; data new int[N] N int max=0; max 0 for(int i=0;i<N;i++) {
			data[i] = sc.nextInt();
			if(data[i]> max) max=data[i];
			if(i!=0&& data[i]<max-1) {
				System.out.print("No");
				break;
			}
			if(i==N-1)System.out.print("Yes");

		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			data[i] = sc.nextInt();
			if(data[i]> max) max=data[i];
			if(i!=0&& data[i]<max-1) {
				System.out.print("No");
				break;
			}
			if(i==N-1)System.out.print("Yes");

		} {
			data[i] = sc.nextInt();
			if(data[i]> max) max=data[i];
			if(i!=0&& data[i]<max-1) {
				System.out.print("No");
				break;
			}
			if(i==N-1)System.out.print("Yes");

		} data[i] = sc.nextInt() data[i] data i sc.nextInt() sc.nextInt sc if(data[i]> max) max=data[i]; data[i]> max data[i] data i max max=data[i] max data[i] data i if(i!=0&& data[i]<max-1) {
				System.out.print("No");
				break;
			} i!=0&& data[i]<max-1 i!=0 i 0 data[i]<max-1 data[i] data i max-1 max 1 {
				System.out.print("No");
				break;
			} System.out.print("No") System.out.print System.out System System.out "No" break; if(i==N-1)System.out.print("Yes"); i==N-1 i N-1 N 1 System.out.print("Yes") System.out.print System.out System System.out "Yes" String args[] args public class Main{
static int N= 0;

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		N =sc.nextInt();
		int data[] =new int[N];
		int max=0;
		for(int i=0;i<N;i++) {
			data[i] = sc.nextInt();
			if(data[i]> max) max=data[i];
			if(i!=0&& data[i]<max-1) {
				System.out.print("No");
				break;
			}
			if(i==N-1)System.out.print("Yes");

		}
		
		
}
} public class Main{
static int N= 0;

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		N =sc.nextInt();
		int data[] =new int[N];
		int max=0;
		for(int i=0;i<N;i++) {
			data[i] = sc.nextInt();
			if(data[i]> max) max=data[i];
			if(i!=0&& data[i]<max-1) {
				System.out.print("No");
				break;
			}
			if(i==N-1)System.out.print("Yes");

		}
		
		
}
} Main
import java.util.*;
public class Main{
static int N= 0;

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		N =sc.nextInt();
		int data[] =new int[N];
		int max=0;
		for(int i=0;i<N;i++) {
			data[i] = sc.nextInt();
			if(data[i]> max) max=data[i];
			if(i!=0&& data[i]<max-1) {
				System.out.print("No");
				break;
			}
			if(i==N-1)System.out.print("Yes");

		}
		
		
}
}