import java.util.*;
public class Main
{
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n=in.nextInt();
		int arr[]=new int[n];
		int max=(int)-1e9;
		for(int i=0;i<n;i++)
		{
			arr[i]=in.nextInt();
		}
		int mid=n-1;
		while(mid>=1)
		{
			if(arr[mid]<arr[mid-1])
			{
				arr[mid-1]--;
			}
			mid--;
		}
//		System.out.println(Arrays.toString(arr));
		mid=0;
		while(mid<=arr.length-2)
		{
			if(arr[mid]>arr[mid+1])
			{
				System.out.println("No");
				System.exit(0);
			}
			mid++;
		}
		System.out.println("Yes");
	}
} import java.util.*; util.* java public class Main
{
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n=in.nextInt();
		int arr[]=new int[n];
		int max=(int)-1e9;
		for(int i=0;i<n;i++)
		{
			arr[i]=in.nextInt();
		}
		int mid=n-1;
		while(mid>=1)
		{
			if(arr[mid]<arr[mid-1])
			{
				arr[mid-1]--;
			}
			mid--;
		}
//		System.out.println(Arrays.toString(arr));
		mid=0;
		while(mid<=arr.length-2)
		{
			if(arr[mid]>arr[mid+1])
			{
				System.out.println("No");
				System.exit(0);
			}
			mid++;
		}
		System.out.println("Yes");
	}
} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n=in.nextInt();
		int arr[]=new int[n];
		int max=(int)-1e9;
		for(int i=0;i<n;i++)
		{
			arr[i]=in.nextInt();
		}
		int mid=n-1;
		while(mid>=1)
		{
			if(arr[mid]<arr[mid-1])
			{
				arr[mid-1]--;
			}
			mid--;
		}
//		System.out.println(Arrays.toString(arr));
		mid=0;
		while(mid<=arr.length-2)
		{
			if(arr[mid]>arr[mid+1])
			{
				System.out.println("No");
				System.exit(0);
			}
			mid++;
		}
		System.out.println("Yes");
	} main {
		Scanner in = new Scanner(System.in);
		int n=in.nextInt();
		int arr[]=new int[n];
		int max=(int)-1e9;
		for(int i=0;i<n;i++)
		{
			arr[i]=in.nextInt();
		}
		int mid=n-1;
		while(mid>=1)
		{
			if(arr[mid]<arr[mid-1])
			{
				arr[mid-1]--;
			}
			mid--;
		}
//		System.out.println(Arrays.toString(arr));
		mid=0;
		while(mid<=arr.length-2)
		{
			if(arr[mid]>arr[mid+1])
			{
				System.out.println("No");
				System.exit(0);
			}
			mid++;
		}
		System.out.println("Yes");
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int n=in.nextInt(); n in.nextInt() in.nextInt in int arr[]=new int[n]; arr new int[n] n int max=(int)-1e9; max (int)-1e9 1e9 for(int i=0;i<n;i++)
		{
			arr[i]=in.nextInt();
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			arr[i]=in.nextInt();
		} {
			arr[i]=in.nextInt();
		} arr[i]=in.nextInt() arr[i] arr i in.nextInt() in.nextInt in int mid=n-1; mid n-1 n 1 while(mid>=1)
		{
			if(arr[mid]<arr[mid-1])
			{
				arr[mid-1]--;
			}
			mid--;
		} mid>=1 mid 1 {
			if(arr[mid]<arr[mid-1])
			{
				arr[mid-1]--;
			}
			mid--;
		} if(arr[mid]<arr[mid-1])
			{
				arr[mid-1]--;
			} arr[mid]<arr[mid-1] arr[mid] arr mid arr[mid-1] arr mid-1 mid 1 {
				arr[mid-1]--;
			} arr[mid-1]-- arr[mid-1] arr mid-1 mid 1 mid-- mid mid=0 mid 0 while(mid<=arr.length-2)
		{
			if(arr[mid]>arr[mid+1])
			{
				System.out.println("No");
				System.exit(0);
			}
			mid++;
		} mid<=arr.length-2 mid arr.length-2 arr.length arr arr.length 2 {
			if(arr[mid]>arr[mid+1])
			{
				System.out.println("No");
				System.exit(0);
			}
			mid++;
		} if(arr[mid]>arr[mid+1])
			{
				System.out.println("No");
				System.exit(0);
			} arr[mid]>arr[mid+1] arr[mid] arr mid arr[mid+1] arr mid+1 mid 1 {
				System.out.println("No");
				System.exit(0);
			} System.out.println("No") System.out.println System.out System System.out "No" System.exit(0) System.exit System 0 mid++ mid 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) {
		Scanner in = new Scanner(System.in);
		int n=in.nextInt();
		int arr[]=new int[n];
		int max=(int)-1e9;
		for(int i=0;i<n;i++)
		{
			arr[i]=in.nextInt();
		}
		int mid=n-1;
		while(mid>=1)
		{
			if(arr[mid]<arr[mid-1])
			{
				arr[mid-1]--;
			}
			mid--;
		}
//		System.out.println(Arrays.toString(arr));
		mid=0;
		while(mid<=arr.length-2)
		{
			if(arr[mid]>arr[mid+1])
			{
				System.out.println("No");
				System.exit(0);
			}
			mid++;
		}
		System.out.println("Yes");
	}
} public class Main
{
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n=in.nextInt();
		int arr[]=new int[n];
		int max=(int)-1e9;
		for(int i=0;i<n;i++)
		{
			arr[i]=in.nextInt();
		}
		int mid=n-1;
		while(mid>=1)
		{
			if(arr[mid]<arr[mid-1])
			{
				arr[mid-1]--;
			}
			mid--;
		}
//		System.out.println(Arrays.toString(arr));
		mid=0;
		while(mid<=arr.length-2)
		{
			if(arr[mid]>arr[mid+1])
			{
				System.out.println("No");
				System.exit(0);
			}
			mid++;
		}
		System.out.println("Yes");
	}
} Main
import java.util.*;
public class Main
{
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n=in.nextInt();
		int arr[]=new int[n];
		int max=(int)-1e9;
		for(int i=0;i<n;i++)
		{
			arr[i]=in.nextInt();
		}
		int mid=n-1;
		while(mid>=1)
		{
			if(arr[mid]<arr[mid-1])
			{
				arr[mid-1]--;
			}
			mid--;
		}
//		System.out.println(Arrays.toString(arr));
		mid=0;
		while(mid<=arr.length-2)
		{
			if(arr[mid]>arr[mid+1])
			{
				System.out.println("No");
				System.exit(0);
			}
			mid++;
		}
		System.out.println("Yes");
	}
}