
import java.io.*;
import java.util.*;

public class Main
{
	public static void main(String []args)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		
		int n=Integer.parseInt(br.readLine());
		String []s=br.readLine().split(" ");
		
		int a[]=new int[n];
		
		for(int i=0;i<n;i++)
			a[i]=Integer.parseInt(s[i]);
					
		boolean flag=true;
		
		for(int i=n-2;i>=0;i--)
		{
			if(a[i] > a[i+1])
				a[i]--;	
		}
		
		for(int i=1;i<n;i++)
		{
			if(a[i]-a[i-1]<0)
			{
				flag=false;
				//break;
			}
		}
		
		if(flag == true)
			System.out.println("Yes");	
		else
			System.out.println("No");		
	}
}

 import java.io.*; io.* java import java.util.*; util.* java public class Main
{
	public static void main(String []args)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		
		int n=Integer.parseInt(br.readLine());
		String []s=br.readLine().split(" ");
		
		int a[]=new int[n];
		
		for(int i=0;i<n;i++)
			a[i]=Integer.parseInt(s[i]);
					
		boolean flag=true;
		
		for(int i=n-2;i>=0;i--)
		{
			if(a[i] > a[i+1])
				a[i]--;	
		}
		
		for(int i=1;i<n;i++)
		{
			if(a[i]-a[i-1]<0)
			{
				flag=false;
				//break;
			}
		}
		
		if(flag == true)
			System.out.println("Yes");	
		else
			System.out.println("No");		
	}
} Main public static void main(String []args)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		
		int n=Integer.parseInt(br.readLine());
		String []s=br.readLine().split(" ");
		
		int a[]=new int[n];
		
		for(int i=0;i<n;i++)
			a[i]=Integer.parseInt(s[i]);
					
		boolean flag=true;
		
		for(int i=n-2;i>=0;i--)
		{
			if(a[i] > a[i+1])
				a[i]--;	
		}
		
		for(int i=1;i<n;i++)
		{
			if(a[i]-a[i-1]<0)
			{
				flag=false;
				//break;
			}
		}
		
		if(flag == true)
			System.out.println("Yes");	
		else
			System.out.println("No");		
	} main {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		
		int n=Integer.parseInt(br.readLine());
		String []s=br.readLine().split(" ");
		
		int a[]=new int[n];
		
		for(int i=0;i<n;i++)
			a[i]=Integer.parseInt(s[i]);
					
		boolean flag=true;
		
		for(int i=n-2;i>=0;i--)
		{
			if(a[i] > a[i+1])
				a[i]--;	
		}
		
		for(int i=1;i<n;i++)
		{
			if(a[i]-a[i-1]<0)
			{
				flag=false;
				//break;
			}
		}
		
		if(flag == true)
			System.out.println("Yes");	
		else
			System.out.println("No");		
	} BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n=Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String []s=br.readLine().split(" "); s br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int a[]=new int[n]; a new int[n] n for(int i=0;i<n;i++)
			a[i]=Integer.parseInt(s[i]); int i=0; int i=0; i 0 i<n i n i++ i++ i a[i]=Integer.parseInt(s[i]); a[i]=Integer.parseInt(s[i]) a[i] a i Integer.parseInt(s[i]) Integer.parseInt Integer s[i] s i boolean flag=true; flag true for(int i=n-2;i>=0;i--)
		{
			if(a[i] > a[i+1])
				a[i]--;	
		} int i=n-2; int i=n-2; i n-2 n 2 i>=0 i 0 i-- i-- i {
			if(a[i] > a[i+1])
				a[i]--;	
		} {
			if(a[i] > a[i+1])
				a[i]--;	
		} if(a[i] > a[i+1])
				a[i]--; a[i] > a[i+1] a[i] a i a[i+1] a i+1 i 1 a[i]-- a[i] a i for(int i=1;i<n;i++)
		{
			if(a[i]-a[i-1]<0)
			{
				flag=false;
				//break;
			}
		} int i=1; int i=1; i 1 i<n i n i++ i++ i {
			if(a[i]-a[i-1]<0)
			{
				flag=false;
				//break;
			}
		} {
			if(a[i]-a[i-1]<0)
			{
				flag=false;
				//break;
			}
		} if(a[i]-a[i-1]<0)
			{
				flag=false;
				//break;
			} a[i]-a[i-1]<0 a[i]-a[i-1] a[i] a i a[i-1] a i-1 i 1 0 {
				flag=false;
				//break;
			} flag=false flag false if(flag == true)
			System.out.println("Yes");	
		else
			System.out.println("No"); flag == true flag true 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)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		
		int n=Integer.parseInt(br.readLine());
		String []s=br.readLine().split(" ");
		
		int a[]=new int[n];
		
		for(int i=0;i<n;i++)
			a[i]=Integer.parseInt(s[i]);
					
		boolean flag=true;
		
		for(int i=n-2;i>=0;i--)
		{
			if(a[i] > a[i+1])
				a[i]--;	
		}
		
		for(int i=1;i<n;i++)
		{
			if(a[i]-a[i-1]<0)
			{
				flag=false;
				//break;
			}
		}
		
		if(flag == true)
			System.out.println("Yes");	
		else
			System.out.println("No");		
	}
} public class Main
{
	public static void main(String []args)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		
		int n=Integer.parseInt(br.readLine());
		String []s=br.readLine().split(" ");
		
		int a[]=new int[n];
		
		for(int i=0;i<n;i++)
			a[i]=Integer.parseInt(s[i]);
					
		boolean flag=true;
		
		for(int i=n-2;i>=0;i--)
		{
			if(a[i] > a[i+1])
				a[i]--;	
		}
		
		for(int i=1;i<n;i++)
		{
			if(a[i]-a[i-1]<0)
			{
				flag=false;
				//break;
			}
		}
		
		if(flag == true)
			System.out.println("Yes");	
		else
			System.out.println("No");		
	}
} Main

import java.io.*;
import java.util.*;

public class Main
{
	public static void main(String []args)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		
		int n=Integer.parseInt(br.readLine());
		String []s=br.readLine().split(" ");
		
		int a[]=new int[n];
		
		for(int i=0;i<n;i++)
			a[i]=Integer.parseInt(s[i]);
					
		boolean flag=true;
		
		for(int i=n-2;i>=0;i--)
		{
			if(a[i] > a[i+1])
				a[i]--;	
		}
		
		for(int i=1;i<n;i++)
		{
			if(a[i]-a[i-1]<0)
			{
				flag=false;
				//break;
			}
		}
		
		if(flag == true)
			System.out.println("Yes");	
		else
			System.out.println("No");		
	}
}


