import java.util.*;
public class Main {
public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
  	int N = sc.nextInt();
	int[] H = new int[N];
  	int cnt=1;
  
	for(int j=0;j<N;j++){
      H[j] = sc.nextInt();
    }
  
  	for(int i=N-1;i>=1;i--){
      if(H[i-1]-1==H[i]){
        H[i-1]--;
        cnt++;
      }else if(H[i-1]<=H[i]){
        cnt++;
      }else{
        break;
      }
    }
  	
  
	//System.out.println("cnt="+cnt);
	if(cnt == N){
		System.out.println("Yes");
    }else{
      	System.out.println("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[] H = new int[N];
  	int cnt=1;
  
	for(int j=0;j<N;j++){
      H[j] = sc.nextInt();
    }
  
  	for(int i=N-1;i>=1;i--){
      if(H[i-1]-1==H[i]){
        H[i-1]--;
        cnt++;
      }else if(H[i-1]<=H[i]){
        cnt++;
      }else{
        break;
      }
    }
  	
  
	//System.out.println("cnt="+cnt);
	if(cnt == N){
		System.out.println("Yes");
    }else{
      	System.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];
  	int cnt=1;
  
	for(int j=0;j<N;j++){
      H[j] = sc.nextInt();
    }
  
  	for(int i=N-1;i>=1;i--){
      if(H[i-1]-1==H[i]){
        H[i-1]--;
        cnt++;
      }else if(H[i-1]<=H[i]){
        cnt++;
      }else{
        break;
      }
    }
  	
  
	//System.out.println("cnt="+cnt);
	if(cnt == N){
		System.out.println("Yes");
    }else{
      	System.out.println("No");
    }
} main {
	Scanner sc = new Scanner(System.in);
  	int N = sc.nextInt();
	int[] H = new int[N];
  	int cnt=1;
  
	for(int j=0;j<N;j++){
      H[j] = sc.nextInt();
    }
  
  	for(int i=N-1;i>=1;i--){
      if(H[i-1]-1==H[i]){
        H[i-1]--;
        cnt++;
      }else if(H[i-1]<=H[i]){
        cnt++;
      }else{
        break;
      }
    }
  	
  
	//System.out.println("cnt="+cnt);
	if(cnt == N){
		System.out.println("Yes");
    }else{
      	System.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 int cnt=1; cnt 1 for(int j=0;j<N;j++){
      H[j] = sc.nextInt();
    } int j=0; int j=0; j 0 j<N j N j++ j++ j {
      H[j] = sc.nextInt();
    } {
      H[j] = sc.nextInt();
    } H[j] = sc.nextInt() H[j] H j sc.nextInt() sc.nextInt sc for(int i=N-1;i>=1;i--){
      if(H[i-1]-1==H[i]){
        H[i-1]--;
        cnt++;
      }else if(H[i-1]<=H[i]){
        cnt++;
      }else{
        break;
      }
    } int i=N-1; int i=N-1; i N-1 N 1 i>=1 i 1 i-- i-- i {
      if(H[i-1]-1==H[i]){
        H[i-1]--;
        cnt++;
      }else if(H[i-1]<=H[i]){
        cnt++;
      }else{
        break;
      }
    } {
      if(H[i-1]-1==H[i]){
        H[i-1]--;
        cnt++;
      }else if(H[i-1]<=H[i]){
        cnt++;
      }else{
        break;
      }
    } if(H[i-1]-1==H[i]){
        H[i-1]--;
        cnt++;
      }else if(H[i-1]<=H[i]){
        cnt++;
      }else{
        break;
      } H[i-1]-1==H[i] H[i-1]-1 H[i-1] H i-1 i 1 1 H[i] H i {
        H[i-1]--;
        cnt++;
      } H[i-1]-- H[i-1] H i-1 i 1 cnt++ cnt if(H[i-1]<=H[i]){
        cnt++;
      }else{
        break;
      } H[i-1]<=H[i] H[i-1] H i-1 i 1 H[i] H i {
        cnt++;
      } cnt++ cnt {
        break;
      } break; if(cnt == N){
		System.out.println("Yes");
    }else{
      	System.out.println("No");
    } cnt == N cnt N {
		System.out.println("Yes");
    } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
      	System.out.println("No");
    } System.out.println("No") System.out.println System.out System System.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];
  	int cnt=1;
  
	for(int j=0;j<N;j++){
      H[j] = sc.nextInt();
    }
  
  	for(int i=N-1;i>=1;i--){
      if(H[i-1]-1==H[i]){
        H[i-1]--;
        cnt++;
      }else if(H[i-1]<=H[i]){
        cnt++;
      }else{
        break;
      }
    }
  	
  
	//System.out.println("cnt="+cnt);
	if(cnt == N){
		System.out.println("Yes");
    }else{
      	System.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];
  	int cnt=1;
  
	for(int j=0;j<N;j++){
      H[j] = sc.nextInt();
    }
  
  	for(int i=N-1;i>=1;i--){
      if(H[i-1]-1==H[i]){
        H[i-1]--;
        cnt++;
      }else if(H[i-1]<=H[i]){
        cnt++;
      }else{
        break;
      }
    }
  	
  
	//System.out.println("cnt="+cnt);
	if(cnt == N){
		System.out.println("Yes");
    }else{
      	System.out.println("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[] H = new int[N];
  	int cnt=1;
  
	for(int j=0;j<N;j++){
      H[j] = sc.nextInt();
    }
  
  	for(int i=N-1;i>=1;i--){
      if(H[i-1]-1==H[i]){
        H[i-1]--;
        cnt++;
      }else if(H[i-1]<=H[i]){
        cnt++;
      }else{
        break;
      }
    }
  	
  
	//System.out.println("cnt="+cnt);
	if(cnt == N){
		System.out.println("Yes");
    }else{
      	System.out.println("No");
    }
}
}