import java.util.*;
import static java.lang.System.*;

public class Main{
  public static void main(String[] args){
	  Scanner sc = new Scanner(System.in);
	  
	  int N = sc.nextInt();
	  int[] H = new int[N];
	  boolean isTrue = true;
	  
	  if(N == 1)
		  out.println("Yes");
	  else {
		  H[0] = sc.nextInt();
		  int max = H[0];
		  for(int i=1; i<N; i++) {
			  H[i] = sc.nextInt();
			  if(H[i] > H[i-1]) {
				  max = H[i];
			  }
			  if( H[i] + 1 < max) {
				  isTrue = false;
				  break;
			  }
		  }

		  if (isTrue) out.println("Yes");
		  else out.println("No");
	  }
  	}
  }	   import java.util.*; util.* java import static java.lang.System.*; import static java.lang.System.*; import static java.lang.System.*; public class Main{
  public static void main(String[] args){
	  Scanner sc = new Scanner(System.in);
	  
	  int N = sc.nextInt();
	  int[] H = new int[N];
	  boolean isTrue = true;
	  
	  if(N == 1)
		  out.println("Yes");
	  else {
		  H[0] = sc.nextInt();
		  int max = H[0];
		  for(int i=1; i<N; i++) {
			  H[i] = sc.nextInt();
			  if(H[i] > H[i-1]) {
				  max = H[i];
			  }
			  if( H[i] + 1 < max) {
				  isTrue = false;
				  break;
			  }
		  }

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

		  if (isTrue) out.println("Yes");
		  else out.println("No");
	  }
  	} main {
	  Scanner sc = new Scanner(System.in);
	  
	  int N = sc.nextInt();
	  int[] H = new int[N];
	  boolean isTrue = true;
	  
	  if(N == 1)
		  out.println("Yes");
	  else {
		  H[0] = sc.nextInt();
		  int max = H[0];
		  for(int i=1; i<N; i++) {
			  H[i] = sc.nextInt();
			  if(H[i] > H[i-1]) {
				  max = H[i];
			  }
			  if( H[i] + 1 < max) {
				  isTrue = false;
				  break;
			  }
		  }

		  if (isTrue) out.println("Yes");
		  else out.println("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 boolean isTrue = true; isTrue true if(N == 1)
		  out.println("Yes");
	  else {
		  H[0] = sc.nextInt();
		  int max = H[0];
		  for(int i=1; i<N; i++) {
			  H[i] = sc.nextInt();
			  if(H[i] > H[i-1]) {
				  max = H[i];
			  }
			  if( H[i] + 1 < max) {
				  isTrue = false;
				  break;
			  }
		  }

		  if (isTrue) out.println("Yes");
		  else out.println("No");
	  } N == 1 N 1 out.println("Yes") out.println out "Yes" {
		  H[0] = sc.nextInt();
		  int max = H[0];
		  for(int i=1; i<N; i++) {
			  H[i] = sc.nextInt();
			  if(H[i] > H[i-1]) {
				  max = H[i];
			  }
			  if( H[i] + 1 < max) {
				  isTrue = false;
				  break;
			  }
		  }

		  if (isTrue) out.println("Yes");
		  else out.println("No");
	  } H[0] = sc.nextInt() H[0] H 0 sc.nextInt() sc.nextInt sc int max = H[0]; max H[0] H 0 for(int i=1; i<N; i++) {
			  H[i] = sc.nextInt();
			  if(H[i] > H[i-1]) {
				  max = H[i];
			  }
			  if( H[i] + 1 < max) {
				  isTrue = false;
				  break;
			  }
		  } int i=1; int i=1; i 1 i<N i N i++ i++ i {
			  H[i] = sc.nextInt();
			  if(H[i] > H[i-1]) {
				  max = H[i];
			  }
			  if( H[i] + 1 < max) {
				  isTrue = false;
				  break;
			  }
		  } {
			  H[i] = sc.nextInt();
			  if(H[i] > H[i-1]) {
				  max = H[i];
			  }
			  if( H[i] + 1 < max) {
				  isTrue = false;
				  break;
			  }
		  } H[i] = sc.nextInt() H[i] H i sc.nextInt() sc.nextInt sc if(H[i] > H[i-1]) {
				  max = H[i];
			  } H[i] > H[i-1] H[i] H i H[i-1] H i-1 i 1 {
				  max = H[i];
			  } max = H[i] max H[i] H i if( H[i] + 1 < max) {
				  isTrue = false;
				  break;
			  } H[i] + 1 < max H[i] + 1 H[i] H i 1 max {
				  isTrue = false;
				  break;
			  } isTrue = false isTrue false break; if (isTrue) out.println("Yes");
		  else out.println("No"); isTrue out.println("Yes") out.println out "Yes" out.println("No") out.println out "No" String[] args args public class Main{
  public static void main(String[] args){
	  Scanner sc = new Scanner(System.in);
	  
	  int N = sc.nextInt();
	  int[] H = new int[N];
	  boolean isTrue = true;
	  
	  if(N == 1)
		  out.println("Yes");
	  else {
		  H[0] = sc.nextInt();
		  int max = H[0];
		  for(int i=1; i<N; i++) {
			  H[i] = sc.nextInt();
			  if(H[i] > H[i-1]) {
				  max = H[i];
			  }
			  if( H[i] + 1 < max) {
				  isTrue = false;
				  break;
			  }
		  }

		  if (isTrue) out.println("Yes");
		  else out.println("No");
	  }
  	}
  } public class Main{
  public static void main(String[] args){
	  Scanner sc = new Scanner(System.in);
	  
	  int N = sc.nextInt();
	  int[] H = new int[N];
	  boolean isTrue = true;
	  
	  if(N == 1)
		  out.println("Yes");
	  else {
		  H[0] = sc.nextInt();
		  int max = H[0];
		  for(int i=1; i<N; i++) {
			  H[i] = sc.nextInt();
			  if(H[i] > H[i-1]) {
				  max = H[i];
			  }
			  if( H[i] + 1 < max) {
				  isTrue = false;
				  break;
			  }
		  }

		  if (isTrue) out.println("Yes");
		  else out.println("No");
	  }
  	}
  } Main
import java.util.*;
import static java.lang.System.*;

public class Main{
  public static void main(String[] args){
	  Scanner sc = new Scanner(System.in);
	  
	  int N = sc.nextInt();
	  int[] H = new int[N];
	  boolean isTrue = true;
	  
	  if(N == 1)
		  out.println("Yes");
	  else {
		  H[0] = sc.nextInt();
		  int max = H[0];
		  for(int i=1; i<N; i++) {
			  H[i] = sc.nextInt();
			  if(H[i] > H[i-1]) {
				  max = H[i];
			  }
			  if( H[i] + 1 < max) {
				  isTrue = false;
				  break;
			  }
		  }

		  if (isTrue) out.println("Yes");
		  else out.println("No");
	  }
  	}
  }	  