import java.util.*;
public class Main{
	public static void main(String args[]) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int H[]=new int[N];
		for(int i=0;i<N;i++) {
			H[i]=sc.nextInt();
		}
		sc.close();
		boolean signal=true;
		for(int j=(N-1);j>0;j--) {
			if(H[j]==H[j-1]-1) {
				H[j-1]-=1;
			}else if(H[j]<H[j-1]-1) {
				signal=false;
				break;
			}
		}
		if(signal) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
} import java.util.*; util.* java public class Main{
	public static void main(String args[]) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int H[]=new int[N];
		for(int i=0;i<N;i++) {
			H[i]=sc.nextInt();
		}
		sc.close();
		boolean signal=true;
		for(int j=(N-1);j>0;j--) {
			if(H[j]==H[j-1]-1) {
				H[j-1]-=1;
			}else if(H[j]<H[j-1]-1) {
				signal=false;
				break;
			}
		}
		if(signal) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
} Main public static void main(String args[]) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int H[]=new int[N];
		for(int i=0;i<N;i++) {
			H[i]=sc.nextInt();
		}
		sc.close();
		boolean signal=true;
		for(int j=(N-1);j>0;j--) {
			if(H[j]==H[j-1]-1) {
				H[j-1]-=1;
			}else if(H[j]<H[j-1]-1) {
				signal=false;
				break;
			}
		}
		if(signal) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	} main {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int H[]=new int[N];
		for(int i=0;i<N;i++) {
			H[i]=sc.nextInt();
		}
		sc.close();
		boolean signal=true;
		for(int j=(N-1);j>0;j--) {
			if(H[j]==H[j-1]-1) {
				H[j-1]-=1;
			}else if(H[j]<H[j-1]-1) {
				signal=false;
				break;
			}
		}
		if(signal) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int N=sc.nextInt(); N sc.nextInt() sc.nextInt sc int H[]=new int[N]; H new int[N] N for(int i=0;i<N;i++) {
			H[i]=sc.nextInt();
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			H[i]=sc.nextInt();
		} {
			H[i]=sc.nextInt();
		} H[i]=sc.nextInt() H[i] H i sc.nextInt() sc.nextInt sc sc.close() sc.close sc boolean signal=true; signal true for(int j=(N-1);j>0;j--) {
			if(H[j]==H[j-1]-1) {
				H[j-1]-=1;
			}else if(H[j]<H[j-1]-1) {
				signal=false;
				break;
			}
		} int j=(N-1); int j=(N-1); j (N-1) N 1 j>0 j 0 j-- j-- j {
			if(H[j]==H[j-1]-1) {
				H[j-1]-=1;
			}else if(H[j]<H[j-1]-1) {
				signal=false;
				break;
			}
		} {
			if(H[j]==H[j-1]-1) {
				H[j-1]-=1;
			}else if(H[j]<H[j-1]-1) {
				signal=false;
				break;
			}
		} if(H[j]==H[j-1]-1) {
				H[j-1]-=1;
			}else if(H[j]<H[j-1]-1) {
				signal=false;
				break;
			} H[j]==H[j-1]-1 H[j] H j H[j-1]-1 H[j-1] H j-1 j 1 1 {
				H[j-1]-=1;
			} H[j-1]-=1 H[j-1] H j-1 j 1 1 if(H[j]<H[j-1]-1) {
				signal=false;
				break;
			} H[j]<H[j-1]-1 H[j] H j H[j-1]-1 H[j-1] H j-1 j 1 1 {
				signal=false;
				break;
			} signal=false signal false break; if(signal) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		} signal {
			System.out.println("Yes");
		} System.out.println("Yes") System.out.println System.out System System.out "Yes" {
			System.out.println("No");
		} 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 sc=new Scanner(System.in);
		int N=sc.nextInt();
		int H[]=new int[N];
		for(int i=0;i<N;i++) {
			H[i]=sc.nextInt();
		}
		sc.close();
		boolean signal=true;
		for(int j=(N-1);j>0;j--) {
			if(H[j]==H[j-1]-1) {
				H[j-1]-=1;
			}else if(H[j]<H[j-1]-1) {
				signal=false;
				break;
			}
		}
		if(signal) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
} public class Main{
	public static void main(String args[]) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int H[]=new int[N];
		for(int i=0;i<N;i++) {
			H[i]=sc.nextInt();
		}
		sc.close();
		boolean signal=true;
		for(int j=(N-1);j>0;j--) {
			if(H[j]==H[j-1]-1) {
				H[j-1]-=1;
			}else if(H[j]<H[j-1]-1) {
				signal=false;
				break;
			}
		}
		if(signal) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
} Main
import java.util.*;
public class Main{
	public static void main(String args[]) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int H[]=new int[N];
		for(int i=0;i<N;i++) {
			H[i]=sc.nextInt();
		}
		sc.close();
		boolean signal=true;
		for(int j=(N-1);j>0;j--) {
			if(H[j]==H[j-1]-1) {
				H[j-1]-=1;
			}else if(H[j]<H[j-1]-1) {
				signal=false;
				break;
			}
		}
		if(signal) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}