							//	package Dynamic;
import java.awt.Paint;

import java.io.*;
import java.math.*;
import java.util.*;
public class Main{
	static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static StringTokenizer st;
	static long c=0l; 
    static public void main(String[] args)throws IOException
    {
    	st=new StringTokenizer(br.readLine());
    	int n=i();
    	int ar[]=ari(n);
    	if(n==1)
    	{
    		pl("Yes");
    		System.exit(0);
    	}
    	int val=Integer.MIN_VALUE;
    	for(int x=1;x<n;x++)
    	{
    		if(ar[x]<val||ar[x]-ar[x-1]<-1)
    		{
    			pl("No");
        		System.exit(0);	
    		}
    		else if(ar[x]-ar[x-1]==-1)
    		{
    			val=ar[x];	
    		}
    		
    	}
    	//pl(val);
    	if(ar[n-1]<val)
    	{
    		pl("No");
    		System.exit(0);	
    	}
    	pl("Yes");
		//System.exit(0);
    }
    static int i()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return Integer.parseInt(st.nextToken());
    }
    static long l()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return Long.parseLong(st.nextToken());
    }
    static String s()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return st.nextToken();
    }
    static double d()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return Double.parseDouble(st.nextToken());
    }
    static void p(String p)
    {
    	System.out.print(p);
    }
    static void pl(String pl)
    {
    	System.out.println(pl);
    }
    static void pl(double pl)
    {
    	System.out.println(pl);
    }
    static void pl(int pl)
    {
    	System.out.println(pl);
    }
    static void pl(char pl)
    {
    	System.out.println(pl);
    }
    static void pl(long pl)
    {
    	System.out.println(pl);
    }
    static void pl()
    {
    	System.out.println();
    }
    static int[] ari(int n)throws IOException
    {
    	int ar[]=new int[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=i();
    	return ar;
    }
    static long[] arl(int n)throws IOException
    {
    	long ar[]=new long[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=l();
    	return ar;
    }
    static String[] ars(int n)throws IOException
    {
    	String ar[]=new String[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=s();
    	return ar;
    }
    static double[] ard(int n)throws IOException
    {
    	double ar[]=new double[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=d();
    	return ar;
    }
    static char[] arc(int n)throws IOException
    {
    	char ar[]=new char[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=st.nextToken().charAt(0);
    	return ar;
    }
    static void pari(int ar[])
    {
    	for(int a:ar)
    		System.out.print(a+" ");
    }
    static void parl(long ar[])
    {
    	for(long a:ar)
    		System.out.print(a+" ");
    }
    static void pars(String ar[])
    {
    	for(String a:ar)
    		System.out.print(a+" ");
    }
    static void pard(double ar[])
    {
    	for(double a:ar)
    		System.out.print(a+" ");
    }
    static void parc(char ar[])
    {
    	for(char a:ar)
    		System.out.print(a+" ");
    }
} import java.awt.Paint; Paint java.awt import java.io.*; io.* java import java.math.*; math.* java import java.util.*; util.* java public class Main{
	static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static StringTokenizer st;
	static long c=0l; 
    static public void main(String[] args)throws IOException
    {
    	st=new StringTokenizer(br.readLine());
    	int n=i();
    	int ar[]=ari(n);
    	if(n==1)
    	{
    		pl("Yes");
    		System.exit(0);
    	}
    	int val=Integer.MIN_VALUE;
    	for(int x=1;x<n;x++)
    	{
    		if(ar[x]<val||ar[x]-ar[x-1]<-1)
    		{
    			pl("No");
        		System.exit(0);	
    		}
    		else if(ar[x]-ar[x-1]==-1)
    		{
    			val=ar[x];	
    		}
    		
    	}
    	//pl(val);
    	if(ar[n-1]<val)
    	{
    		pl("No");
    		System.exit(0);	
    	}
    	pl("Yes");
		//System.exit(0);
    }
    static int i()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return Integer.parseInt(st.nextToken());
    }
    static long l()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return Long.parseLong(st.nextToken());
    }
    static String s()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return st.nextToken();
    }
    static double d()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return Double.parseDouble(st.nextToken());
    }
    static void p(String p)
    {
    	System.out.print(p);
    }
    static void pl(String pl)
    {
    	System.out.println(pl);
    }
    static void pl(double pl)
    {
    	System.out.println(pl);
    }
    static void pl(int pl)
    {
    	System.out.println(pl);
    }
    static void pl(char pl)
    {
    	System.out.println(pl);
    }
    static void pl(long pl)
    {
    	System.out.println(pl);
    }
    static void pl()
    {
    	System.out.println();
    }
    static int[] ari(int n)throws IOException
    {
    	int ar[]=new int[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=i();
    	return ar;
    }
    static long[] arl(int n)throws IOException
    {
    	long ar[]=new long[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=l();
    	return ar;
    }
    static String[] ars(int n)throws IOException
    {
    	String ar[]=new String[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=s();
    	return ar;
    }
    static double[] ard(int n)throws IOException
    {
    	double ar[]=new double[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=d();
    	return ar;
    }
    static char[] arc(int n)throws IOException
    {
    	char ar[]=new char[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=st.nextToken().charAt(0);
    	return ar;
    }
    static void pari(int ar[])
    {
    	for(int a:ar)
    		System.out.print(a+" ");
    }
    static void parl(long ar[])
    {
    	for(long a:ar)
    		System.out.print(a+" ");
    }
    static void pars(String ar[])
    {
    	for(String a:ar)
    		System.out.print(a+" ");
    }
    static void pard(double ar[])
    {
    	for(double a:ar)
    		System.out.print(a+" ");
    }
    static void parc(char ar[])
    {
    	for(char a:ar)
    		System.out.print(a+" ");
    }
} Main static BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) static StringTokenizer st; st static long c=0l; c 0l static public void main(String[] args)throws IOException
    {
    	st=new StringTokenizer(br.readLine());
    	int n=i();
    	int ar[]=ari(n);
    	if(n==1)
    	{
    		pl("Yes");
    		System.exit(0);
    	}
    	int val=Integer.MIN_VALUE;
    	for(int x=1;x<n;x++)
    	{
    		if(ar[x]<val||ar[x]-ar[x-1]<-1)
    		{
    			pl("No");
        		System.exit(0);	
    		}
    		else if(ar[x]-ar[x-1]==-1)
    		{
    			val=ar[x];	
    		}
    		
    	}
    	//pl(val);
    	if(ar[n-1]<val)
    	{
    		pl("No");
    		System.exit(0);	
    	}
    	pl("Yes");
		//System.exit(0);
    } main {
    	st=new StringTokenizer(br.readLine());
    	int n=i();
    	int ar[]=ari(n);
    	if(n==1)
    	{
    		pl("Yes");
    		System.exit(0);
    	}
    	int val=Integer.MIN_VALUE;
    	for(int x=1;x<n;x++)
    	{
    		if(ar[x]<val||ar[x]-ar[x-1]<-1)
    		{
    			pl("No");
        		System.exit(0);	
    		}
    		else if(ar[x]-ar[x-1]==-1)
    		{
    			val=ar[x];	
    		}
    		
    	}
    	//pl(val);
    	if(ar[n-1]<val)
    	{
    		pl("No");
    		System.exit(0);	
    	}
    	pl("Yes");
		//System.exit(0);
    } st=new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) int n=i(); n i() i int ar[]=ari(n); ar ari(n) ari n if(n==1)
    	{
    		pl("Yes");
    		System.exit(0);
    	} n==1 n 1 {
    		pl("Yes");
    		System.exit(0);
    	} pl("Yes") pl "Yes" System.exit(0) System.exit System 0 int val=Integer.MIN_VALUE; val Integer.MIN_VALUE Integer Integer.MIN_VALUE for(int x=1;x<n;x++)
    	{
    		if(ar[x]<val||ar[x]-ar[x-1]<-1)
    		{
    			pl("No");
        		System.exit(0);	
    		}
    		else if(ar[x]-ar[x-1]==-1)
    		{
    			val=ar[x];	
    		}
    		
    	} int x=1; int x=1; x 1 x<n x n x++ x++ x {
    		if(ar[x]<val||ar[x]-ar[x-1]<-1)
    		{
    			pl("No");
        		System.exit(0);	
    		}
    		else if(ar[x]-ar[x-1]==-1)
    		{
    			val=ar[x];	
    		}
    		
    	} {
    		if(ar[x]<val||ar[x]-ar[x-1]<-1)
    		{
    			pl("No");
        		System.exit(0);	
    		}
    		else if(ar[x]-ar[x-1]==-1)
    		{
    			val=ar[x];	
    		}
    		
    	} if(ar[x]<val||ar[x]-ar[x-1]<-1)
    		{
    			pl("No");
        		System.exit(0);	
    		}
    		else if(ar[x]-ar[x-1]==-1)
    		{
    			val=ar[x];	
    		} ar[x]<val||ar[x]-ar[x-1]<-1 ar[x]<val ar[x] ar x val ar[x]-ar[x-1]<-1 ar[x]-ar[x-1] ar[x] ar x ar[x-1] ar x-1 x 1 -1 1 {
    			pl("No");
        		System.exit(0);	
    		} pl("No") pl "No" System.exit(0) System.exit System 0 if(ar[x]-ar[x-1]==-1)
    		{
    			val=ar[x];	
    		} ar[x]-ar[x-1]==-1 ar[x]-ar[x-1] ar[x] ar x ar[x-1] ar x-1 x 1 -1 1 {
    			val=ar[x];	
    		} val=ar[x] val ar[x] ar x if(ar[n-1]<val)
    	{
    		pl("No");
    		System.exit(0);	
    	} ar[n-1]<val ar[n-1] ar n-1 n 1 val {
    		pl("No");
    		System.exit(0);	
    	} pl("No") pl "No" System.exit(0) System.exit System 0 pl("Yes") pl "Yes" String[] args args static int i()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return Integer.parseInt(st.nextToken());
    } i {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return Integer.parseInt(st.nextToken());
    } if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine()); !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st st=new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return Integer.parseInt(st.nextToken()); Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st static long l()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return Long.parseLong(st.nextToken());
    } l {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return Long.parseLong(st.nextToken());
    } if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine()); !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st st=new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return Long.parseLong(st.nextToken()); Long.parseLong(st.nextToken()) Long.parseLong Long st.nextToken() st.nextToken st static String s()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return st.nextToken();
    } s {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return st.nextToken();
    } if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine()); !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st st=new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st static double d()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return Double.parseDouble(st.nextToken());
    } d {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return Double.parseDouble(st.nextToken());
    } if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine()); !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st st=new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return Double.parseDouble(st.nextToken()); Double.parseDouble(st.nextToken()) Double.parseDouble Double st.nextToken() st.nextToken st static void p(String p)
    {
    	System.out.print(p);
    } p {
    	System.out.print(p);
    } System.out.print(p) System.out.print System.out System System.out p String p p static void pl(String pl)
    {
    	System.out.println(pl);
    } pl {
    	System.out.println(pl);
    } System.out.println(pl) System.out.println System.out System System.out pl String pl pl static void pl(double pl)
    {
    	System.out.println(pl);
    } pl {
    	System.out.println(pl);
    } System.out.println(pl) System.out.println System.out System System.out pl double pl pl static void pl(int pl)
    {
    	System.out.println(pl);
    } pl {
    	System.out.println(pl);
    } System.out.println(pl) System.out.println System.out System System.out pl int pl pl static void pl(char pl)
    {
    	System.out.println(pl);
    } pl {
    	System.out.println(pl);
    } System.out.println(pl) System.out.println System.out System System.out pl char pl pl static void pl(long pl)
    {
    	System.out.println(pl);
    } pl {
    	System.out.println(pl);
    } System.out.println(pl) System.out.println System.out System System.out pl long pl pl static void pl()
    {
    	System.out.println();
    } pl {
    	System.out.println();
    } System.out.println() System.out.println System.out System System.out static int[] ari(int n)throws IOException
    {
    	int ar[]=new int[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=i();
    	return ar;
    } ari {
    	int ar[]=new int[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=i();
    	return ar;
    } int ar[]=new int[n]; ar new int[n] n if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine()); !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st st=new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) for(int x=0;x<n;x++)
    		ar[x]=i(); int x=0; int x=0; x 0 x<n x n x++ x++ x ar[x]=i(); ar[x]=i() ar[x] ar x i() i return ar; ar int n n static long[] arl(int n)throws IOException
    {
    	long ar[]=new long[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=l();
    	return ar;
    } arl {
    	long ar[]=new long[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=l();
    	return ar;
    } long ar[]=new long[n]; ar new long[n] n if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine()); !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st st=new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) for(int x=0;x<n;x++)
    		ar[x]=l(); int x=0; int x=0; x 0 x<n x n x++ x++ x ar[x]=l(); ar[x]=l() ar[x] ar x l() l return ar; ar int n n static String[] ars(int n)throws IOException
    {
    	String ar[]=new String[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=s();
    	return ar;
    } ars {
    	String ar[]=new String[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=s();
    	return ar;
    } String ar[]=new String[n]; ar new String[n] n if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine()); !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st st=new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) for(int x=0;x<n;x++)
    		ar[x]=s(); int x=0; int x=0; x 0 x<n x n x++ x++ x ar[x]=s(); ar[x]=s() ar[x] ar x s() s return ar; ar int n n static double[] ard(int n)throws IOException
    {
    	double ar[]=new double[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=d();
    	return ar;
    } ard {
    	double ar[]=new double[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=d();
    	return ar;
    } double ar[]=new double[n]; ar new double[n] n if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine()); !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st st=new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) for(int x=0;x<n;x++)
    		ar[x]=d(); int x=0; int x=0; x 0 x<n x n x++ x++ x ar[x]=d(); ar[x]=d() ar[x] ar x d() d return ar; ar int n n static char[] arc(int n)throws IOException
    {
    	char ar[]=new char[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=st.nextToken().charAt(0);
    	return ar;
    } arc {
    	char ar[]=new char[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=st.nextToken().charAt(0);
    	return ar;
    } char ar[]=new char[n]; ar new char[n] n if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine()); !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st st=new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) for(int x=0;x<n;x++)
    		ar[x]=st.nextToken().charAt(0); int x=0; int x=0; x 0 x<n x n x++ x++ x ar[x]=st.nextToken().charAt(0); ar[x]=st.nextToken().charAt(0) ar[x] ar x st.nextToken().charAt(0) st.nextToken().charAt st.nextToken() st.nextToken st 0 return ar; ar int n n static void pari(int ar[])
    {
    	for(int a:ar)
    		System.out.print(a+" ");
    } pari {
    	for(int a:ar)
    		System.out.print(a+" ");
    } for(int a:ar)
    		System.out.print(a+" "); int a ar System.out.print(a+" "); System.out.print(a+" ") System.out.print System.out System System.out a+" " a " " int ar[] ar static void parl(long ar[])
    {
    	for(long a:ar)
    		System.out.print(a+" ");
    } parl {
    	for(long a:ar)
    		System.out.print(a+" ");
    } for(long a:ar)
    		System.out.print(a+" "); long a ar System.out.print(a+" "); System.out.print(a+" ") System.out.print System.out System System.out a+" " a " " long ar[] ar static void pars(String ar[])
    {
    	for(String a:ar)
    		System.out.print(a+" ");
    } pars {
    	for(String a:ar)
    		System.out.print(a+" ");
    } for(String a:ar)
    		System.out.print(a+" "); String a ar System.out.print(a+" "); System.out.print(a+" ") System.out.print System.out System System.out a+" " a " " String ar[] ar static void pard(double ar[])
    {
    	for(double a:ar)
    		System.out.print(a+" ");
    } pard {
    	for(double a:ar)
    		System.out.print(a+" ");
    } for(double a:ar)
    		System.out.print(a+" "); double a ar System.out.print(a+" "); System.out.print(a+" ") System.out.print System.out System System.out a+" " a " " double ar[] ar static void parc(char ar[])
    {
    	for(char a:ar)
    		System.out.print(a+" ");
    } parc {
    	for(char a:ar)
    		System.out.print(a+" ");
    } for(char a:ar)
    		System.out.print(a+" "); char a ar System.out.print(a+" "); System.out.print(a+" ") System.out.print System.out System System.out a+" " a " " char ar[] ar public class Main{
	static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static StringTokenizer st;
	static long c=0l; 
    static public void main(String[] args)throws IOException
    {
    	st=new StringTokenizer(br.readLine());
    	int n=i();
    	int ar[]=ari(n);
    	if(n==1)
    	{
    		pl("Yes");
    		System.exit(0);
    	}
    	int val=Integer.MIN_VALUE;
    	for(int x=1;x<n;x++)
    	{
    		if(ar[x]<val||ar[x]-ar[x-1]<-1)
    		{
    			pl("No");
        		System.exit(0);	
    		}
    		else if(ar[x]-ar[x-1]==-1)
    		{
    			val=ar[x];	
    		}
    		
    	}
    	//pl(val);
    	if(ar[n-1]<val)
    	{
    		pl("No");
    		System.exit(0);	
    	}
    	pl("Yes");
		//System.exit(0);
    }
    static int i()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return Integer.parseInt(st.nextToken());
    }
    static long l()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return Long.parseLong(st.nextToken());
    }
    static String s()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return st.nextToken();
    }
    static double d()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return Double.parseDouble(st.nextToken());
    }
    static void p(String p)
    {
    	System.out.print(p);
    }
    static void pl(String pl)
    {
    	System.out.println(pl);
    }
    static void pl(double pl)
    {
    	System.out.println(pl);
    }
    static void pl(int pl)
    {
    	System.out.println(pl);
    }
    static void pl(char pl)
    {
    	System.out.println(pl);
    }
    static void pl(long pl)
    {
    	System.out.println(pl);
    }
    static void pl()
    {
    	System.out.println();
    }
    static int[] ari(int n)throws IOException
    {
    	int ar[]=new int[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=i();
    	return ar;
    }
    static long[] arl(int n)throws IOException
    {
    	long ar[]=new long[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=l();
    	return ar;
    }
    static String[] ars(int n)throws IOException
    {
    	String ar[]=new String[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=s();
    	return ar;
    }
    static double[] ard(int n)throws IOException
    {
    	double ar[]=new double[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=d();
    	return ar;
    }
    static char[] arc(int n)throws IOException
    {
    	char ar[]=new char[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=st.nextToken().charAt(0);
    	return ar;
    }
    static void pari(int ar[])
    {
    	for(int a:ar)
    		System.out.print(a+" ");
    }
    static void parl(long ar[])
    {
    	for(long a:ar)
    		System.out.print(a+" ");
    }
    static void pars(String ar[])
    {
    	for(String a:ar)
    		System.out.print(a+" ");
    }
    static void pard(double ar[])
    {
    	for(double a:ar)
    		System.out.print(a+" ");
    }
    static void parc(char ar[])
    {
    	for(char a:ar)
    		System.out.print(a+" ");
    }
} public class Main{
	static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static StringTokenizer st;
	static long c=0l; 
    static public void main(String[] args)throws IOException
    {
    	st=new StringTokenizer(br.readLine());
    	int n=i();
    	int ar[]=ari(n);
    	if(n==1)
    	{
    		pl("Yes");
    		System.exit(0);
    	}
    	int val=Integer.MIN_VALUE;
    	for(int x=1;x<n;x++)
    	{
    		if(ar[x]<val||ar[x]-ar[x-1]<-1)
    		{
    			pl("No");
        		System.exit(0);	
    		}
    		else if(ar[x]-ar[x-1]==-1)
    		{
    			val=ar[x];	
    		}
    		
    	}
    	//pl(val);
    	if(ar[n-1]<val)
    	{
    		pl("No");
    		System.exit(0);	
    	}
    	pl("Yes");
		//System.exit(0);
    }
    static int i()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return Integer.parseInt(st.nextToken());
    }
    static long l()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return Long.parseLong(st.nextToken());
    }
    static String s()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return st.nextToken();
    }
    static double d()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return Double.parseDouble(st.nextToken());
    }
    static void p(String p)
    {
    	System.out.print(p);
    }
    static void pl(String pl)
    {
    	System.out.println(pl);
    }
    static void pl(double pl)
    {
    	System.out.println(pl);
    }
    static void pl(int pl)
    {
    	System.out.println(pl);
    }
    static void pl(char pl)
    {
    	System.out.println(pl);
    }
    static void pl(long pl)
    {
    	System.out.println(pl);
    }
    static void pl()
    {
    	System.out.println();
    }
    static int[] ari(int n)throws IOException
    {
    	int ar[]=new int[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=i();
    	return ar;
    }
    static long[] arl(int n)throws IOException
    {
    	long ar[]=new long[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=l();
    	return ar;
    }
    static String[] ars(int n)throws IOException
    {
    	String ar[]=new String[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=s();
    	return ar;
    }
    static double[] ard(int n)throws IOException
    {
    	double ar[]=new double[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=d();
    	return ar;
    }
    static char[] arc(int n)throws IOException
    {
    	char ar[]=new char[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=st.nextToken().charAt(0);
    	return ar;
    }
    static void pari(int ar[])
    {
    	for(int a:ar)
    		System.out.print(a+" ");
    }
    static void parl(long ar[])
    {
    	for(long a:ar)
    		System.out.print(a+" ");
    }
    static void pars(String ar[])
    {
    	for(String a:ar)
    		System.out.print(a+" ");
    }
    static void pard(double ar[])
    {
    	for(double a:ar)
    		System.out.print(a+" ");
    }
    static void parc(char ar[])
    {
    	for(char a:ar)
    		System.out.print(a+" ");
    }
} Main
							//	package Dynamic;
import java.awt.Paint;

import java.io.*;
import java.math.*;
import java.util.*;
public class Main{
	static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static StringTokenizer st;
	static long c=0l; 
    static public void main(String[] args)throws IOException
    {
    	st=new StringTokenizer(br.readLine());
    	int n=i();
    	int ar[]=ari(n);
    	if(n==1)
    	{
    		pl("Yes");
    		System.exit(0);
    	}
    	int val=Integer.MIN_VALUE;
    	for(int x=1;x<n;x++)
    	{
    		if(ar[x]<val||ar[x]-ar[x-1]<-1)
    		{
    			pl("No");
        		System.exit(0);	
    		}
    		else if(ar[x]-ar[x-1]==-1)
    		{
    			val=ar[x];	
    		}
    		
    	}
    	//pl(val);
    	if(ar[n-1]<val)
    	{
    		pl("No");
    		System.exit(0);	
    	}
    	pl("Yes");
		//System.exit(0);
    }
    static int i()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return Integer.parseInt(st.nextToken());
    }
    static long l()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return Long.parseLong(st.nextToken());
    }
    static String s()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return st.nextToken();
    }
    static double d()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return Double.parseDouble(st.nextToken());
    }
    static void p(String p)
    {
    	System.out.print(p);
    }
    static void pl(String pl)
    {
    	System.out.println(pl);
    }
    static void pl(double pl)
    {
    	System.out.println(pl);
    }
    static void pl(int pl)
    {
    	System.out.println(pl);
    }
    static void pl(char pl)
    {
    	System.out.println(pl);
    }
    static void pl(long pl)
    {
    	System.out.println(pl);
    }
    static void pl()
    {
    	System.out.println();
    }
    static int[] ari(int n)throws IOException
    {
    	int ar[]=new int[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=i();
    	return ar;
    }
    static long[] arl(int n)throws IOException
    {
    	long ar[]=new long[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=l();
    	return ar;
    }
    static String[] ars(int n)throws IOException
    {
    	String ar[]=new String[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=s();
    	return ar;
    }
    static double[] ard(int n)throws IOException
    {
    	double ar[]=new double[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=d();
    	return ar;
    }
    static char[] arc(int n)throws IOException
    {
    	char ar[]=new char[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=st.nextToken().charAt(0);
    	return ar;
    }
    static void pari(int ar[])
    {
    	for(int a:ar)
    		System.out.print(a+" ");
    }
    static void parl(long ar[])
    {
    	for(long a:ar)
    		System.out.print(a+" ");
    }
    static void pars(String ar[])
    {
    	for(String a:ar)
    		System.out.print(a+" ");
    }
    static void pard(double ar[])
    {
    	for(double a:ar)
    		System.out.print(a+" ");
    }
    static void parc(char ar[])
    {
    	for(char a:ar)
    		System.out.print(a+" ");
    }
}