
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int n=scn.nextInt();
		int []arr=new int[n];
		for(int i=0;i<n;i++) {
			arr[i]=scn.nextInt();
		}
		int flag=0;
		for(int i=n-2;i>=0;) {
			if(arr[i+1]>=arr[i]) {
				i--;
			}else {
				if(arr[i]-1!=arr[i+1]) {
					flag=1;
					break;
				}else {
					arr[i]--;
					i--;
				}
			}
		}
		if(flag==1) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int n=scn.nextInt();
		int []arr=new int[n];
		for(int i=0;i<n;i++) {
			arr[i]=scn.nextInt();
		}
		int flag=0;
		for(int i=n-2;i>=0;) {
			if(arr[i+1]>=arr[i]) {
				i--;
			}else {
				if(arr[i]-1!=arr[i+1]) {
					flag=1;
					break;
				}else {
					arr[i]--;
					i--;
				}
			}
		}
		if(flag==1) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}
	}

} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int n=scn.nextInt();
		int []arr=new int[n];
		for(int i=0;i<n;i++) {
			arr[i]=scn.nextInt();
		}
		int flag=0;
		for(int i=n-2;i>=0;) {
			if(arr[i+1]>=arr[i]) {
				i--;
			}else {
				if(arr[i]-1!=arr[i+1]) {
					flag=1;
					break;
				}else {
					arr[i]--;
					i--;
				}
			}
		}
		if(flag==1) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}
	} main {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int n=scn.nextInt();
		int []arr=new int[n];
		for(int i=0;i<n;i++) {
			arr[i]=scn.nextInt();
		}
		int flag=0;
		for(int i=n-2;i>=0;) {
			if(arr[i+1]>=arr[i]) {
				i--;
			}else {
				if(arr[i]-1!=arr[i+1]) {
					flag=1;
					break;
				}else {
					arr[i]--;
					i--;
				}
			}
		}
		if(flag==1) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}
	} Scanner scn=new Scanner(System.in); scn new Scanner(System.in) int n=scn.nextInt(); n scn.nextInt() scn.nextInt scn int []arr=new int[n]; arr new int[n] n for(int i=0;i<n;i++) {
			arr[i]=scn.nextInt();
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			arr[i]=scn.nextInt();
		} {
			arr[i]=scn.nextInt();
		} arr[i]=scn.nextInt() arr[i] arr i scn.nextInt() scn.nextInt scn int flag=0; flag 0 for(int i=n-2;i>=0;) {
			if(arr[i+1]>=arr[i]) {
				i--;
			}else {
				if(arr[i]-1!=arr[i+1]) {
					flag=1;
					break;
				}else {
					arr[i]--;
					i--;
				}
			}
		} int i=n-2; int i=n-2; i n-2 n 2 i>=0 i 0 {
			if(arr[i+1]>=arr[i]) {
				i--;
			}else {
				if(arr[i]-1!=arr[i+1]) {
					flag=1;
					break;
				}else {
					arr[i]--;
					i--;
				}
			}
		} {
			if(arr[i+1]>=arr[i]) {
				i--;
			}else {
				if(arr[i]-1!=arr[i+1]) {
					flag=1;
					break;
				}else {
					arr[i]--;
					i--;
				}
			}
		} if(arr[i+1]>=arr[i]) {
				i--;
			}else {
				if(arr[i]-1!=arr[i+1]) {
					flag=1;
					break;
				}else {
					arr[i]--;
					i--;
				}
			} arr[i+1]>=arr[i] arr[i+1] arr i+1 i 1 arr[i] arr i {
				i--;
			} i-- i {
				if(arr[i]-1!=arr[i+1]) {
					flag=1;
					break;
				}else {
					arr[i]--;
					i--;
				}
			} if(arr[i]-1!=arr[i+1]) {
					flag=1;
					break;
				}else {
					arr[i]--;
					i--;
				} arr[i]-1!=arr[i+1] arr[i]-1 arr[i] arr i 1 arr[i+1] arr i+1 i 1 {
					flag=1;
					break;
				} flag=1 flag 1 break; {
					arr[i]--;
					i--;
				} arr[i]-- arr[i] arr i i-- i if(flag==1) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		} flag==1 flag 1 {
			System.out.println("No");
		} System.out.println("No") System.out.println System.out System System.out "No" {
			System.out.println("Yes");
		} System.out.println("Yes") System.out.println System.out System System.out "Yes" String[] args args public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int n=scn.nextInt();
		int []arr=new int[n];
		for(int i=0;i<n;i++) {
			arr[i]=scn.nextInt();
		}
		int flag=0;
		for(int i=n-2;i>=0;) {
			if(arr[i+1]>=arr[i]) {
				i--;
			}else {
				if(arr[i]-1!=arr[i+1]) {
					flag=1;
					break;
				}else {
					arr[i]--;
					i--;
				}
			}
		}
		if(flag==1) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}
	}

} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int n=scn.nextInt();
		int []arr=new int[n];
		for(int i=0;i<n;i++) {
			arr[i]=scn.nextInt();
		}
		int flag=0;
		for(int i=n-2;i>=0;) {
			if(arr[i+1]>=arr[i]) {
				i--;
			}else {
				if(arr[i]-1!=arr[i+1]) {
					flag=1;
					break;
				}else {
					arr[i]--;
					i--;
				}
			}
		}
		if(flag==1) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}
	}

} Main

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int n=scn.nextInt();
		int []arr=new int[n];
		for(int i=0;i<n;i++) {
			arr[i]=scn.nextInt();
		}
		int flag=0;
		for(int i=n-2;i>=0;) {
			if(arr[i+1]>=arr[i]) {
				i--;
			}else {
				if(arr[i]-1!=arr[i+1]) {
					flag=1;
					break;
				}else {
					arr[i]--;
					i--;
				}
			}
		}
		if(flag==1) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}
	}

}
