import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int[] arr = new int[x];
		for(int i = 0; i<x;i++)arr[i]=sc.nextInt();
		boolean works = true;
		int max = arr[0]-1;
		for(int i = 1;i<arr.length;i++) {
			int temp;
			if(arr[i]==max)temp=arr[i];
			else {
				temp = arr[i]-1;	
			}
			if(temp>=max)max = temp;
			else if(temp<max) {
				works = false;
				break;
			}
		}
		
		System.out.println(works?"Yes":"No");

	}

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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int[] arr = new int[x];
		for(int i = 0; i<x;i++)arr[i]=sc.nextInt();
		boolean works = true;
		int max = arr[0]-1;
		for(int i = 1;i<arr.length;i++) {
			int temp;
			if(arr[i]==max)temp=arr[i];
			else {
				temp = arr[i]-1;	
			}
			if(temp>=max)max = temp;
			else if(temp<max) {
				works = false;
				break;
			}
		}
		
		System.out.println(works?"Yes":"No");

	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int[] arr = new int[x];
		for(int i = 0; i<x;i++)arr[i]=sc.nextInt();
		boolean works = true;
		int max = arr[0]-1;
		for(int i = 1;i<arr.length;i++) {
			int temp;
			if(arr[i]==max)temp=arr[i];
			else {
				temp = arr[i]-1;	
			}
			if(temp>=max)max = temp;
			else if(temp<max) {
				works = false;
				break;
			}
		}
		
		System.out.println(works?"Yes":"No");

	} main {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int[] arr = new int[x];
		for(int i = 0; i<x;i++)arr[i]=sc.nextInt();
		boolean works = true;
		int max = arr[0]-1;
		for(int i = 1;i<arr.length;i++) {
			int temp;
			if(arr[i]==max)temp=arr[i];
			else {
				temp = arr[i]-1;	
			}
			if(temp>=max)max = temp;
			else if(temp<max) {
				works = false;
				break;
			}
		}
		
		System.out.println(works?"Yes":"No");

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc int[] arr = new int[x]; arr new int[x] x for(int i = 0; i<x;i++)arr[i]=sc.nextInt(); int i = 0; int i = 0; i 0 i<x i x i++ i++ i arr[i]=sc.nextInt(); arr[i]=sc.nextInt() arr[i] arr i sc.nextInt() sc.nextInt sc boolean works = true; works true int max = arr[0]-1; max arr[0]-1 arr[0] arr 0 1 for(int i = 1;i<arr.length;i++) {
			int temp;
			if(arr[i]==max)temp=arr[i];
			else {
				temp = arr[i]-1;	
			}
			if(temp>=max)max = temp;
			else if(temp<max) {
				works = false;
				break;
			}
		} int i = 1; int i = 1; i 1 i<arr.length i arr.length arr arr.length i++ i++ i {
			int temp;
			if(arr[i]==max)temp=arr[i];
			else {
				temp = arr[i]-1;	
			}
			if(temp>=max)max = temp;
			else if(temp<max) {
				works = false;
				break;
			}
		} {
			int temp;
			if(arr[i]==max)temp=arr[i];
			else {
				temp = arr[i]-1;	
			}
			if(temp>=max)max = temp;
			else if(temp<max) {
				works = false;
				break;
			}
		} int temp; temp if(arr[i]==max)temp=arr[i];
			else {
				temp = arr[i]-1;	
			} arr[i]==max arr[i] arr i max temp=arr[i] temp arr[i] arr i {
				temp = arr[i]-1;	
			} temp = arr[i]-1 temp arr[i]-1 arr[i] arr i 1 if(temp>=max)max = temp;
			else if(temp<max) {
				works = false;
				break;
			} temp>=max temp max max = temp max temp if(temp<max) {
				works = false;
				break;
			} temp<max temp max {
				works = false;
				break;
			} works = false works false break; System.out.println(works?"Yes":"No") System.out.println System.out System System.out works?"Yes":"No" works "Yes" "No" String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int[] arr = new int[x];
		for(int i = 0; i<x;i++)arr[i]=sc.nextInt();
		boolean works = true;
		int max = arr[0]-1;
		for(int i = 1;i<arr.length;i++) {
			int temp;
			if(arr[i]==max)temp=arr[i];
			else {
				temp = arr[i]-1;	
			}
			if(temp>=max)max = temp;
			else if(temp<max) {
				works = false;
				break;
			}
		}
		
		System.out.println(works?"Yes":"No");

	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int[] arr = new int[x];
		for(int i = 0; i<x;i++)arr[i]=sc.nextInt();
		boolean works = true;
		int max = arr[0]-1;
		for(int i = 1;i<arr.length;i++) {
			int temp;
			if(arr[i]==max)temp=arr[i];
			else {
				temp = arr[i]-1;	
			}
			if(temp>=max)max = temp;
			else if(temp<max) {
				works = false;
				break;
			}
		}
		
		System.out.println(works?"Yes":"No");

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int[] arr = new int[x];
		for(int i = 0; i<x;i++)arr[i]=sc.nextInt();
		boolean works = true;
		int max = arr[0]-1;
		for(int i = 1;i<arr.length;i++) {
			int temp;
			if(arr[i]==max)temp=arr[i];
			else {
				temp = arr[i]-1;	
			}
			if(temp>=max)max = temp;
			else if(temp<max) {
				works = false;
				break;
			}
		}
		
		System.out.println(works?"Yes":"No");

	}

}
