import java.util.Scanner;
public class Main {
    public static void main(String[] args) throws Exception {
        
        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();
		}
		
		int max = h[0];
		boolean b = true;
		for(int i=0; i<N; i++) {
			if(h[i]<max-1) {
				b = false;
				break;
			}
			if(h[i]>max) {
				max = h[i];
			}
		}
		System.out.println(b? "Yes":"No");
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) throws Exception {
        
        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();
		}
		
		int max = h[0];
		boolean b = true;
		for(int i=0; i<N; i++) {
			if(h[i]<max-1) {
				b = false;
				break;
			}
			if(h[i]>max) {
				max = h[i];
			}
		}
		System.out.println(b? "Yes":"No");
    }
} Main public static void main(String[] args) throws Exception {
        
        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();
		}
		
		int max = h[0];
		boolean b = true;
		for(int i=0; i<N; i++) {
			if(h[i]<max-1) {
				b = false;
				break;
			}
			if(h[i]>max) {
				max = h[i];
			}
		}
		System.out.println(b? "Yes":"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();
		}
		
		int max = h[0];
		boolean b = true;
		for(int i=0; i<N; i++) {
			if(h[i]<max-1) {
				b = false;
				break;
			}
			if(h[i]>max) {
				max = h[i];
			}
		}
		System.out.println(b? "Yes":"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 int max = h[0]; max h[0] h 0 boolean b = true; b true for(int i=0; i<N; i++) {
			if(h[i]<max-1) {
				b = false;
				break;
			}
			if(h[i]>max) {
				max = h[i];
			}
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			if(h[i]<max-1) {
				b = false;
				break;
			}
			if(h[i]>max) {
				max = h[i];
			}
		} {
			if(h[i]<max-1) {
				b = false;
				break;
			}
			if(h[i]>max) {
				max = h[i];
			}
		} if(h[i]<max-1) {
				b = false;
				break;
			} h[i]<max-1 h[i] h i max-1 max 1 {
				b = false;
				break;
			} b = false b false break; if(h[i]>max) {
				max = h[i];
			} h[i]>max h[i] h i max {
				max = h[i];
			} max = h[i] max h[i] h i System.out.println(b? "Yes":"No") System.out.println System.out System System.out b? "Yes":"No" b "Yes" "No" String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        
        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();
		}
		
		int max = h[0];
		boolean b = true;
		for(int i=0; i<N; i++) {
			if(h[i]<max-1) {
				b = false;
				break;
			}
			if(h[i]>max) {
				max = h[i];
			}
		}
		System.out.println(b? "Yes":"No");
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        
        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();
		}
		
		int max = h[0];
		boolean b = true;
		for(int i=0; i<N; i++) {
			if(h[i]<max-1) {
				b = false;
				break;
			}
			if(h[i]>max) {
				max = h[i];
			}
		}
		System.out.println(b? "Yes":"No");
    }
} Main
import java.util.Scanner;
public class Main {
    public static void main(String[] args) throws Exception {
        
        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();
		}
		
		int max = h[0];
		boolean b = true;
		for(int i=0; i<N; i++) {
			if(h[i]<max-1) {
				b = false;
				break;
			}
			if(h[i]>max) {
				max = h[i];
			}
		}
		System.out.println(b? "Yes":"No");
    }
}