import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		long[] a = new long[N];
		for( int i=0; i<N; i++ ){
			a[i] = sc.nextLong();
		}
		long maxium = a[0];
		for( int i=1; i<N; i++ ){
			if( maxium - a[i] >=2 ){
				System.out.println("No");
				break;
			}else{
				maxium = Math.max(maxium,a[i]);
			}
			if( i==N-1 ){
				System.out.println("Yes");
			}
		}
		if( N==1 ){
			System.out.println("Yes");          
        }          
	}
} import java.util.*; util.* java public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		long[] a = new long[N];
		for( int i=0; i<N; i++ ){
			a[i] = sc.nextLong();
		}
		long maxium = a[0];
		for( int i=1; i<N; i++ ){
			if( maxium - a[i] >=2 ){
				System.out.println("No");
				break;
			}else{
				maxium = Math.max(maxium,a[i]);
			}
			if( i==N-1 ){
				System.out.println("Yes");
			}
		}
		if( N==1 ){
			System.out.println("Yes");          
        }          
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		long[] a = new long[N];
		for( int i=0; i<N; i++ ){
			a[i] = sc.nextLong();
		}
		long maxium = a[0];
		for( int i=1; i<N; i++ ){
			if( maxium - a[i] >=2 ){
				System.out.println("No");
				break;
			}else{
				maxium = Math.max(maxium,a[i]);
			}
			if( i==N-1 ){
				System.out.println("Yes");
			}
		}
		if( N==1 ){
			System.out.println("Yes");          
        }          
	} main {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		long[] a = new long[N];
		for( int i=0; i<N; i++ ){
			a[i] = sc.nextLong();
		}
		long maxium = a[0];
		for( int i=1; i<N; i++ ){
			if( maxium - a[i] >=2 ){
				System.out.println("No");
				break;
			}else{
				maxium = Math.max(maxium,a[i]);
			}
			if( i==N-1 ){
				System.out.println("Yes");
			}
		}
		if( N==1 ){
			System.out.println("Yes");          
        }          
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc long[] a = new long[N]; a new long[N] N for( int i=0; i<N; i++ ){
			a[i] = sc.nextLong();
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			a[i] = sc.nextLong();
		} {
			a[i] = sc.nextLong();
		} a[i] = sc.nextLong() a[i] a i sc.nextLong() sc.nextLong sc long maxium = a[0]; maxium a[0] a 0 for( int i=1; i<N; i++ ){
			if( maxium - a[i] >=2 ){
				System.out.println("No");
				break;
			}else{
				maxium = Math.max(maxium,a[i]);
			}
			if( i==N-1 ){
				System.out.println("Yes");
			}
		} int i=1; int i=1; i 1 i<N i N i++ i++ i {
			if( maxium - a[i] >=2 ){
				System.out.println("No");
				break;
			}else{
				maxium = Math.max(maxium,a[i]);
			}
			if( i==N-1 ){
				System.out.println("Yes");
			}
		} {
			if( maxium - a[i] >=2 ){
				System.out.println("No");
				break;
			}else{
				maxium = Math.max(maxium,a[i]);
			}
			if( i==N-1 ){
				System.out.println("Yes");
			}
		} if( maxium - a[i] >=2 ){
				System.out.println("No");
				break;
			}else{
				maxium = Math.max(maxium,a[i]);
			} maxium - a[i] >=2 maxium - a[i] maxium a[i] a i 2 {
				System.out.println("No");
				break;
			} System.out.println("No") System.out.println System.out System System.out "No" break; {
				maxium = Math.max(maxium,a[i]);
			} maxium = Math.max(maxium,a[i]) maxium Math.max(maxium,a[i]) Math.max Math maxium a[i] a i if( i==N-1 ){
				System.out.println("Yes");
			} i==N-1 i N-1 N 1 {
				System.out.println("Yes");
			} System.out.println("Yes") System.out.println System.out System System.out "Yes" if( N==1 ){
			System.out.println("Yes");          
        } N==1 N 1 {
			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){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		long[] a = new long[N];
		for( int i=0; i<N; i++ ){
			a[i] = sc.nextLong();
		}
		long maxium = a[0];
		for( int i=1; i<N; i++ ){
			if( maxium - a[i] >=2 ){
				System.out.println("No");
				break;
			}else{
				maxium = Math.max(maxium,a[i]);
			}
			if( i==N-1 ){
				System.out.println("Yes");
			}
		}
		if( N==1 ){
			System.out.println("Yes");          
        }          
	}
} public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		long[] a = new long[N];
		for( int i=0; i<N; i++ ){
			a[i] = sc.nextLong();
		}
		long maxium = a[0];
		for( int i=1; i<N; i++ ){
			if( maxium - a[i] >=2 ){
				System.out.println("No");
				break;
			}else{
				maxium = Math.max(maxium,a[i]);
			}
			if( i==N-1 ){
				System.out.println("Yes");
			}
		}
		if( N==1 ){
			System.out.println("Yes");          
        }          
	}
} Main
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		long[] a = new long[N];
		for( int i=0; i<N; i++ ){
			a[i] = sc.nextLong();
		}
		long maxium = a[0];
		for( int i=1; i<N; i++ ){
			if( maxium - a[i] >=2 ){
				System.out.println("No");
				break;
			}else{
				maxium = Math.max(maxium,a[i]);
			}
			if( i==N-1 ){
				System.out.println("Yes");
			}
		}
		if( N==1 ){
			System.out.println("Yes");          
        }          
	}
}
