import  java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int heights[] = new int[n];
    for(int i = 0; i < n; i++) heights[i] = scan.nextInt();
    scan.close();
    
    int prev = -1;
    boolean judge = true;
    for(int height : heights) {
      if(prev == -1) {
        prev = height;
        continue;
      }
      
      if(prev < height - 1) {
    	  prev = height - 1;
    	  continue;
      }
      
      if(prev > height ) {
        judge = false;
        continue;
      }
    }
    if(judge) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
} import  java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int heights[] = new int[n];
    for(int i = 0; i < n; i++) heights[i] = scan.nextInt();
    scan.close();
    
    int prev = -1;
    boolean judge = true;
    for(int height : heights) {
      if(prev == -1) {
        prev = height;
        continue;
      }
      
      if(prev < height - 1) {
    	  prev = height - 1;
    	  continue;
      }
      
      if(prev > height ) {
        judge = false;
        continue;
      }
    }
    if(judge) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
} Main public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int heights[] = new int[n];
    for(int i = 0; i < n; i++) heights[i] = scan.nextInt();
    scan.close();
    
    int prev = -1;
    boolean judge = true;
    for(int height : heights) {
      if(prev == -1) {
        prev = height;
        continue;
      }
      
      if(prev < height - 1) {
    	  prev = height - 1;
    	  continue;
      }
      
      if(prev > height ) {
        judge = false;
        continue;
      }
    }
    if(judge) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  } main {
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int heights[] = new int[n];
    for(int i = 0; i < n; i++) heights[i] = scan.nextInt();
    scan.close();
    
    int prev = -1;
    boolean judge = true;
    for(int height : heights) {
      if(prev == -1) {
        prev = height;
        continue;
      }
      
      if(prev < height - 1) {
    	  prev = height - 1;
    	  continue;
      }
      
      if(prev > height ) {
        judge = false;
        continue;
      }
    }
    if(judge) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int heights[] = new int[n]; heights new int[n] n for(int i = 0; i < n; i++) heights[i] = scan.nextInt(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i heights[i] = scan.nextInt(); heights[i] = scan.nextInt() heights[i] heights i scan.nextInt() scan.nextInt scan scan.close() scan.close scan int prev = -1; prev -1 1 boolean judge = true; judge true for(int height : heights) {
      if(prev == -1) {
        prev = height;
        continue;
      }
      
      if(prev < height - 1) {
    	  prev = height - 1;
    	  continue;
      }
      
      if(prev > height ) {
        judge = false;
        continue;
      }
    } int height heights {
      if(prev == -1) {
        prev = height;
        continue;
      }
      
      if(prev < height - 1) {
    	  prev = height - 1;
    	  continue;
      }
      
      if(prev > height ) {
        judge = false;
        continue;
      }
    } {
      if(prev == -1) {
        prev = height;
        continue;
      }
      
      if(prev < height - 1) {
    	  prev = height - 1;
    	  continue;
      }
      
      if(prev > height ) {
        judge = false;
        continue;
      }
    } if(prev == -1) {
        prev = height;
        continue;
      } prev == -1 prev -1 1 {
        prev = height;
        continue;
      } prev = height prev height continue; if(prev < height - 1) {
    	  prev = height - 1;
    	  continue;
      } prev < height - 1 prev height - 1 height 1 {
    	  prev = height - 1;
    	  continue;
      } prev = height - 1 prev height - 1 height 1 continue; if(prev > height ) {
        judge = false;
        continue;
      } prev > height prev height {
        judge = false;
        continue;
      } judge = false judge false continue; if(judge) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    } judge {
      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 scan = new Scanner(System.in);
    int n = scan.nextInt();
    int heights[] = new int[n];
    for(int i = 0; i < n; i++) heights[i] = scan.nextInt();
    scan.close();
    
    int prev = -1;
    boolean judge = true;
    for(int height : heights) {
      if(prev == -1) {
        prev = height;
        continue;
      }
      
      if(prev < height - 1) {
    	  prev = height - 1;
    	  continue;
      }
      
      if(prev > height ) {
        judge = false;
        continue;
      }
    }
    if(judge) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
} public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int heights[] = new int[n];
    for(int i = 0; i < n; i++) heights[i] = scan.nextInt();
    scan.close();
    
    int prev = -1;
    boolean judge = true;
    for(int height : heights) {
      if(prev == -1) {
        prev = height;
        continue;
      }
      
      if(prev < height - 1) {
    	  prev = height - 1;
    	  continue;
      }
      
      if(prev > height ) {
        judge = false;
        continue;
      }
    }
    if(judge) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
} Main
import  java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int heights[] = new int[n];
    for(int i = 0; i < n; i++) heights[i] = scan.nextInt();
    scan.close();
    
    int prev = -1;
    boolean judge = true;
    for(int height : heights) {
      if(prev == -1) {
        prev = height;
        continue;
      }
      
      if(prev < height - 1) {
    	  prev = height - 1;
    	  continue;
      }
      
      if(prev > height ) {
        judge = false;
        continue;
      }
    }
    if(judge) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}
