import java.util.*;
 
public class Main {
	
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	int[] Hi = new int[N];
    	int tmp = sc.nextInt();
    	int line = 0;
    	boolean flg = true;
    	for (int i = 1; i < N; i++) {
    		int h = sc.nextInt();
    		if (h + 1 < tmp) {
    			flg = false;
    		} else if (h + 1 == tmp) {
    			if (h < line) {
    				flg = false;
    			}
    			line = h;
    		}
    		tmp = h;
    	}
    	System.out.println(flg ? "Yes" : "No");
    }
} import java.util.*; util.* java public class Main {
	
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	int[] Hi = new int[N];
    	int tmp = sc.nextInt();
    	int line = 0;
    	boolean flg = true;
    	for (int i = 1; i < N; i++) {
    		int h = sc.nextInt();
    		if (h + 1 < tmp) {
    			flg = false;
    		} else if (h + 1 == tmp) {
    			if (h < line) {
    				flg = false;
    			}
    			line = h;
    		}
    		tmp = h;
    	}
    	System.out.println(flg ? "Yes" : "No");
    }
} Main public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	int[] Hi = new int[N];
    	int tmp = sc.nextInt();
    	int line = 0;
    	boolean flg = true;
    	for (int i = 1; i < N; i++) {
    		int h = sc.nextInt();
    		if (h + 1 < tmp) {
    			flg = false;
    		} else if (h + 1 == tmp) {
    			if (h < line) {
    				flg = false;
    			}
    			line = h;
    		}
    		tmp = h;
    	}
    	System.out.println(flg ? "Yes" : "No");
    } main {
    	Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	int[] Hi = new int[N];
    	int tmp = sc.nextInt();
    	int line = 0;
    	boolean flg = true;
    	for (int i = 1; i < N; i++) {
    		int h = sc.nextInt();
    		if (h + 1 < tmp) {
    			flg = false;
    		} else if (h + 1 == tmp) {
    			if (h < line) {
    				flg = false;
    			}
    			line = h;
    		}
    		tmp = h;
    	}
    	System.out.println(flg ? "Yes" : "No");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] Hi = new int[N]; Hi new int[N] N int tmp = sc.nextInt(); tmp sc.nextInt() sc.nextInt sc int line = 0; line 0 boolean flg = true; flg true for (int i = 1; i < N; i++) {
    		int h = sc.nextInt();
    		if (h + 1 < tmp) {
    			flg = false;
    		} else if (h + 1 == tmp) {
    			if (h < line) {
    				flg = false;
    			}
    			line = h;
    		}
    		tmp = h;
    	} int i = 1; int i = 1; i 1 i < N i N i++ i++ i {
    		int h = sc.nextInt();
    		if (h + 1 < tmp) {
    			flg = false;
    		} else if (h + 1 == tmp) {
    			if (h < line) {
    				flg = false;
    			}
    			line = h;
    		}
    		tmp = h;
    	} {
    		int h = sc.nextInt();
    		if (h + 1 < tmp) {
    			flg = false;
    		} else if (h + 1 == tmp) {
    			if (h < line) {
    				flg = false;
    			}
    			line = h;
    		}
    		tmp = h;
    	} int h = sc.nextInt(); h sc.nextInt() sc.nextInt sc if (h + 1 < tmp) {
    			flg = false;
    		} else if (h + 1 == tmp) {
    			if (h < line) {
    				flg = false;
    			}
    			line = h;
    		} h + 1 < tmp h + 1 h 1 tmp {
    			flg = false;
    		} flg = false flg false if (h + 1 == tmp) {
    			if (h < line) {
    				flg = false;
    			}
    			line = h;
    		} h + 1 == tmp h + 1 h 1 tmp {
    			if (h < line) {
    				flg = false;
    			}
    			line = h;
    		} if (h < line) {
    				flg = false;
    			} h < line h line {
    				flg = false;
    			} flg = false flg false line = h line h tmp = h tmp h System.out.println(flg ? "Yes" : "No") System.out.println System.out System System.out flg ? "Yes" : "No" flg "Yes" "No" String[] args args public class Main {
	
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	int[] Hi = new int[N];
    	int tmp = sc.nextInt();
    	int line = 0;
    	boolean flg = true;
    	for (int i = 1; i < N; i++) {
    		int h = sc.nextInt();
    		if (h + 1 < tmp) {
    			flg = false;
    		} else if (h + 1 == tmp) {
    			if (h < line) {
    				flg = false;
    			}
    			line = h;
    		}
    		tmp = h;
    	}
    	System.out.println(flg ? "Yes" : "No");
    }
} public class Main {
	
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	int[] Hi = new int[N];
    	int tmp = sc.nextInt();
    	int line = 0;
    	boolean flg = true;
    	for (int i = 1; i < N; i++) {
    		int h = sc.nextInt();
    		if (h + 1 < tmp) {
    			flg = false;
    		} else if (h + 1 == tmp) {
    			if (h < line) {
    				flg = false;
    			}
    			line = h;
    		}
    		tmp = h;
    	}
    	System.out.println(flg ? "Yes" : "No");
    }
} Main
import java.util.*;
 
public class Main {
	
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	int[] Hi = new int[N];
    	int tmp = sc.nextInt();
    	int line = 0;
    	boolean flg = true;
    	for (int i = 1; i < N; i++) {
    		int h = sc.nextInt();
    		if (h + 1 < tmp) {
    			flg = false;
    		} else if (h + 1 == tmp) {
    			if (h < line) {
    				flg = false;
    			}
    			line = h;
    		}
    		tmp = h;
    	}
    	System.out.println(flg ? "Yes" : "No");
    }
}