import java.util.*;


import java.io.*;
 

 
 
public class Main 
{   
	
	
	public static void main(String[] args) throws IOException 
	{ 
		
		
	
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		StringTokenizer s=new StringTokenizer(br.readLine());
		
		int n=Integer.parseInt(s.nextToken());
		
		int a[]=new int[n];
		
		s=new StringTokenizer(br.readLine());
		for(int i=0;i<n;i++) {
						
			a[i]=Integer.parseInt(s.nextToken());
			
		}
		
		int min[]=new int[n];
		
		min[n-1]=a[n-1];
		for(int i=n-2;i>=0;i--) {
			min[i]=Math.min(a[i], min[i+1]);
		}
//		for(int i=0;i<n;i++) {
//			pw.println(min[i]);
//		}
		
		for(int i=0;i<a.length;i++) {
			if(a[i]-min[i]>1) {
				pw.println("No");
				pw.close();
			}
		}
		pw.println("Yes");
		pw.close();
		
		
	}

} import java.util.*; util.* java import java.io.*; io.* java public class Main 
{   
	
	
	public static void main(String[] args) throws IOException 
	{ 
		
		
	
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		StringTokenizer s=new StringTokenizer(br.readLine());
		
		int n=Integer.parseInt(s.nextToken());
		
		int a[]=new int[n];
		
		s=new StringTokenizer(br.readLine());
		for(int i=0;i<n;i++) {
						
			a[i]=Integer.parseInt(s.nextToken());
			
		}
		
		int min[]=new int[n];
		
		min[n-1]=a[n-1];
		for(int i=n-2;i>=0;i--) {
			min[i]=Math.min(a[i], min[i+1]);
		}
//		for(int i=0;i<n;i++) {
//			pw.println(min[i]);
//		}
		
		for(int i=0;i<a.length;i++) {
			if(a[i]-min[i]>1) {
				pw.println("No");
				pw.close();
			}
		}
		pw.println("Yes");
		pw.close();
		
		
	}

} Main public static void main(String[] args) throws IOException 
	{ 
		
		
	
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		StringTokenizer s=new StringTokenizer(br.readLine());
		
		int n=Integer.parseInt(s.nextToken());
		
		int a[]=new int[n];
		
		s=new StringTokenizer(br.readLine());
		for(int i=0;i<n;i++) {
						
			a[i]=Integer.parseInt(s.nextToken());
			
		}
		
		int min[]=new int[n];
		
		min[n-1]=a[n-1];
		for(int i=n-2;i>=0;i--) {
			min[i]=Math.min(a[i], min[i+1]);
		}
//		for(int i=0;i<n;i++) {
//			pw.println(min[i]);
//		}
		
		for(int i=0;i<a.length;i++) {
			if(a[i]-min[i]>1) {
				pw.println("No");
				pw.close();
			}
		}
		pw.println("Yes");
		pw.close();
		
		
	} main { 
		
		
	
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		StringTokenizer s=new StringTokenizer(br.readLine());
		
		int n=Integer.parseInt(s.nextToken());
		
		int a[]=new int[n];
		
		s=new StringTokenizer(br.readLine());
		for(int i=0;i<n;i++) {
						
			a[i]=Integer.parseInt(s.nextToken());
			
		}
		
		int min[]=new int[n];
		
		min[n-1]=a[n-1];
		for(int i=n-2;i>=0;i--) {
			min[i]=Math.min(a[i], min[i+1]);
		}
//		for(int i=0;i<n;i++) {
//			pw.println(min[i]);
//		}
		
		for(int i=0;i<a.length;i++) {
			if(a[i]-min[i]>1) {
				pw.println("No");
				pw.close();
			}
		}
		pw.println("Yes");
		pw.close();
		
		
	} BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) PrintWriter pw=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); pw new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))) StringTokenizer s=new StringTokenizer(br.readLine()); s new StringTokenizer(br.readLine()) int n=Integer.parseInt(s.nextToken()); n Integer.parseInt(s.nextToken()) Integer.parseInt Integer s.nextToken() s.nextToken s int a[]=new int[n]; a new int[n] n s=new StringTokenizer(br.readLine()) s new StringTokenizer(br.readLine()) for(int i=0;i<n;i++) {
						
			a[i]=Integer.parseInt(s.nextToken());
			
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
						
			a[i]=Integer.parseInt(s.nextToken());
			
		} {
						
			a[i]=Integer.parseInt(s.nextToken());
			
		} a[i]=Integer.parseInt(s.nextToken()) a[i] a i Integer.parseInt(s.nextToken()) Integer.parseInt Integer s.nextToken() s.nextToken s int min[]=new int[n]; min new int[n] n min[n-1]=a[n-1] min[n-1] min n-1 n 1 a[n-1] a n-1 n 1 for(int i=n-2;i>=0;i--) {
			min[i]=Math.min(a[i], min[i+1]);
		} int i=n-2; int i=n-2; i n-2 n 2 i>=0 i 0 i-- i-- i {
			min[i]=Math.min(a[i], min[i+1]);
		} {
			min[i]=Math.min(a[i], min[i+1]);
		} min[i]=Math.min(a[i], min[i+1]) min[i] min i Math.min(a[i], min[i+1]) Math.min Math a[i] a i min[i+1] min i+1 i 1 for(int i=0;i<a.length;i++) {
			if(a[i]-min[i]>1) {
				pw.println("No");
				pw.close();
			}
		} int i=0; int i=0; i 0 i<a.length i a.length a a.length i++ i++ i {
			if(a[i]-min[i]>1) {
				pw.println("No");
				pw.close();
			}
		} {
			if(a[i]-min[i]>1) {
				pw.println("No");
				pw.close();
			}
		} if(a[i]-min[i]>1) {
				pw.println("No");
				pw.close();
			} a[i]-min[i]>1 a[i]-min[i] a[i] a i min[i] min i 1 {
				pw.println("No");
				pw.close();
			} pw.println("No") pw.println pw "No" pw.close() pw.close pw pw.println("Yes") pw.println pw "Yes" pw.close() pw.close pw String[] args args public class Main 
{   
	
	
	public static void main(String[] args) throws IOException 
	{ 
		
		
	
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		StringTokenizer s=new StringTokenizer(br.readLine());
		
		int n=Integer.parseInt(s.nextToken());
		
		int a[]=new int[n];
		
		s=new StringTokenizer(br.readLine());
		for(int i=0;i<n;i++) {
						
			a[i]=Integer.parseInt(s.nextToken());
			
		}
		
		int min[]=new int[n];
		
		min[n-1]=a[n-1];
		for(int i=n-2;i>=0;i--) {
			min[i]=Math.min(a[i], min[i+1]);
		}
//		for(int i=0;i<n;i++) {
//			pw.println(min[i]);
//		}
		
		for(int i=0;i<a.length;i++) {
			if(a[i]-min[i]>1) {
				pw.println("No");
				pw.close();
			}
		}
		pw.println("Yes");
		pw.close();
		
		
	}

} public class Main 
{   
	
	
	public static void main(String[] args) throws IOException 
	{ 
		
		
	
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		StringTokenizer s=new StringTokenizer(br.readLine());
		
		int n=Integer.parseInt(s.nextToken());
		
		int a[]=new int[n];
		
		s=new StringTokenizer(br.readLine());
		for(int i=0;i<n;i++) {
						
			a[i]=Integer.parseInt(s.nextToken());
			
		}
		
		int min[]=new int[n];
		
		min[n-1]=a[n-1];
		for(int i=n-2;i>=0;i--) {
			min[i]=Math.min(a[i], min[i+1]);
		}
//		for(int i=0;i<n;i++) {
//			pw.println(min[i]);
//		}
		
		for(int i=0;i<a.length;i++) {
			if(a[i]-min[i]>1) {
				pw.println("No");
				pw.close();
			}
		}
		pw.println("Yes");
		pw.close();
		
		
	}

} Main
import java.util.*;


import java.io.*;
 

 
 
public class Main 
{   
	
	
	public static void main(String[] args) throws IOException 
	{ 
		
		
	
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		StringTokenizer s=new StringTokenizer(br.readLine());
		
		int n=Integer.parseInt(s.nextToken());
		
		int a[]=new int[n];
		
		s=new StringTokenizer(br.readLine());
		for(int i=0;i<n;i++) {
						
			a[i]=Integer.parseInt(s.nextToken());
			
		}
		
		int min[]=new int[n];
		
		min[n-1]=a[n-1];
		for(int i=n-2;i>=0;i--) {
			min[i]=Math.min(a[i], min[i+1]);
		}
//		for(int i=0;i<n;i++) {
//			pw.println(min[i]);
//		}
		
		for(int i=0;i<a.length;i++) {
			if(a[i]-min[i]>1) {
				pw.println("No");
				pw.close();
			}
		}
		pw.println("Yes");
		pw.close();
		
		
	}

}