import java.util.*;
public class Main{

 public static void main(String[] args)
 {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] list = new int[n];
        for(int i =0;i<n;i++){
          list[i] = sc.nextInt();
        }
        int first = list[0];
        int min = list[0] - 1;
        String judge = "Yes";
        for(int i=1;i<n;i++){
          if(min <= (list[i] - 1)){
              min = list[i] - 1;
          }else if(min == list[i]){
              min = list[i];
          }else{
              judge = "No";
          }
        }
        
        System.out.println(judge);
      
    }

} 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[] list = new int[n];
        for(int i =0;i<n;i++){
          list[i] = sc.nextInt();
        }
        int first = list[0];
        int min = list[0] - 1;
        String judge = "Yes";
        for(int i=1;i<n;i++){
          if(min <= (list[i] - 1)){
              min = list[i] - 1;
          }else if(min == list[i]){
              min = list[i];
          }else{
              judge = "No";
          }
        }
        
        System.out.println(judge);
      
    }

} Main public static void main(String[] args)
 {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] list = new int[n];
        for(int i =0;i<n;i++){
          list[i] = sc.nextInt();
        }
        int first = list[0];
        int min = list[0] - 1;
        String judge = "Yes";
        for(int i=1;i<n;i++){
          if(min <= (list[i] - 1)){
              min = list[i] - 1;
          }else if(min == list[i]){
              min = list[i];
          }else{
              judge = "No";
          }
        }
        
        System.out.println(judge);
      
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] list = new int[n];
        for(int i =0;i<n;i++){
          list[i] = sc.nextInt();
        }
        int first = list[0];
        int min = list[0] - 1;
        String judge = "Yes";
        for(int i=1;i<n;i++){
          if(min <= (list[i] - 1)){
              min = list[i] - 1;
          }else if(min == list[i]){
              min = list[i];
          }else{
              judge = "No";
          }
        }
        
        System.out.println(judge);
      
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] list = new int[n]; list new int[n] n for(int i =0;i<n;i++){
          list[i] = sc.nextInt();
        } int i =0; int i =0; i 0 i<n i n i++ i++ i {
          list[i] = sc.nextInt();
        } {
          list[i] = sc.nextInt();
        } list[i] = sc.nextInt() list[i] list i sc.nextInt() sc.nextInt sc int first = list[0]; first list[0] list 0 int min = list[0] - 1; min list[0] - 1 list[0] list 0 1 String judge = "Yes"; judge "Yes" for(int i=1;i<n;i++){
          if(min <= (list[i] - 1)){
              min = list[i] - 1;
          }else if(min == list[i]){
              min = list[i];
          }else{
              judge = "No";
          }
        } int i=1; int i=1; i 1 i<n i n i++ i++ i {
          if(min <= (list[i] - 1)){
              min = list[i] - 1;
          }else if(min == list[i]){
              min = list[i];
          }else{
              judge = "No";
          }
        } {
          if(min <= (list[i] - 1)){
              min = list[i] - 1;
          }else if(min == list[i]){
              min = list[i];
          }else{
              judge = "No";
          }
        } if(min <= (list[i] - 1)){
              min = list[i] - 1;
          }else if(min == list[i]){
              min = list[i];
          }else{
              judge = "No";
          } min <= (list[i] - 1) min (list[i] - 1) list[i] list i 1 {
              min = list[i] - 1;
          } min = list[i] - 1 min list[i] - 1 list[i] list i 1 if(min == list[i]){
              min = list[i];
          }else{
              judge = "No";
          } min == list[i] min list[i] list i {
              min = list[i];
          } min = list[i] min list[i] list i {
              judge = "No";
          } judge = "No" judge "No" System.out.println(judge) System.out.println System.out System System.out judge String[] args args public class Main{

 public static void main(String[] args)
 {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] list = new int[n];
        for(int i =0;i<n;i++){
          list[i] = sc.nextInt();
        }
        int first = list[0];
        int min = list[0] - 1;
        String judge = "Yes";
        for(int i=1;i<n;i++){
          if(min <= (list[i] - 1)){
              min = list[i] - 1;
          }else if(min == list[i]){
              min = list[i];
          }else{
              judge = "No";
          }
        }
        
        System.out.println(judge);
      
    }

} public class Main{

 public static void main(String[] args)
 {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] list = new int[n];
        for(int i =0;i<n;i++){
          list[i] = sc.nextInt();
        }
        int first = list[0];
        int min = list[0] - 1;
        String judge = "Yes";
        for(int i=1;i<n;i++){
          if(min <= (list[i] - 1)){
              min = list[i] - 1;
          }else if(min == list[i]){
              min = list[i];
          }else{
              judge = "No";
          }
        }
        
        System.out.println(judge);
      
    }

} Main
import java.util.*;
public class Main{

 public static void main(String[] args)
 {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] list = new int[n];
        for(int i =0;i<n;i++){
          list[i] = sc.nextInt();
        }
        int first = list[0];
        int min = list[0] - 1;
        String judge = "Yes";
        for(int i=1;i<n;i++){
          if(min <= (list[i] - 1)){
              min = list[i] - 1;
          }else if(min == list[i]){
              min = list[i];
          }else{
              judge = "No";
          }
        }
        
        System.out.println(judge);
      
    }

}