import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int number, i;
    number = Integer.parseInt(sc.next());
    int[] height = new int[number];
    for(i = 0; i < number; i++) {
      height[i] = Integer.parseInt(sc.next());
    }
    for(i = 1; i < number; i++) {
      if(height[i-1] == height[i]) continue;
      else if(height[i-1] <= height[i] - 1) height[i]--;
      else break;
    }
    if(i == number) 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 number, i;
    number = Integer.parseInt(sc.next());
    int[] height = new int[number];
    for(i = 0; i < number; i++) {
      height[i] = Integer.parseInt(sc.next());
    }
    for(i = 1; i < number; i++) {
      if(height[i-1] == height[i]) continue;
      else if(height[i-1] <= height[i] - 1) height[i]--;
      else break;
    }
    if(i == number) System.out.println("Yes");
    else System.out.println("No");
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int number, i;
    number = Integer.parseInt(sc.next());
    int[] height = new int[number];
    for(i = 0; i < number; i++) {
      height[i] = Integer.parseInt(sc.next());
    }
    for(i = 1; i < number; i++) {
      if(height[i-1] == height[i]) continue;
      else if(height[i-1] <= height[i] - 1) height[i]--;
      else break;
    }
    if(i == number) System.out.println("Yes");
    else System.out.println("No");
  } main {
    Scanner sc = new Scanner(System.in);
    int number, i;
    number = Integer.parseInt(sc.next());
    int[] height = new int[number];
    for(i = 0; i < number; i++) {
      height[i] = Integer.parseInt(sc.next());
    }
    for(i = 1; i < number; i++) {
      if(height[i-1] == height[i]) continue;
      else if(height[i-1] <= height[i] - 1) height[i]--;
      else break;
    }
    if(i == number) System.out.println("Yes");
    else System.out.println("No");
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int number number i; i number = Integer.parseInt(sc.next()) number Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int[] height = new int[number]; height new int[number] number for(i = 0; i < number; i++) {
      height[i] = Integer.parseInt(sc.next());
    } i = 0; i = 0 i 0 i < number i number i++ i++ i {
      height[i] = Integer.parseInt(sc.next());
    } {
      height[i] = Integer.parseInt(sc.next());
    } height[i] = Integer.parseInt(sc.next()) height[i] height i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc for(i = 1; i < number; i++) {
      if(height[i-1] == height[i]) continue;
      else if(height[i-1] <= height[i] - 1) height[i]--;
      else break;
    } i = 1; i = 1 i 1 i < number i number i++ i++ i {
      if(height[i-1] == height[i]) continue;
      else if(height[i-1] <= height[i] - 1) height[i]--;
      else break;
    } {
      if(height[i-1] == height[i]) continue;
      else if(height[i-1] <= height[i] - 1) height[i]--;
      else break;
    } if(height[i-1] == height[i]) continue;
      else if(height[i-1] <= height[i] - 1) height[i]--;
      else break; height[i-1] == height[i] height[i-1] height i-1 i 1 height[i] height i continue; if(height[i-1] <= height[i] - 1) height[i]--;
      else break; height[i-1] <= height[i] - 1 height[i-1] height i-1 i 1 height[i] - 1 height[i] height i 1 height[i]-- height[i] height i break; if(i == number) System.out.println("Yes");
    else System.out.println("No"); i == number i number System.out.println("Yes") System.out.println System.out System System.out "Yes" 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 number, i;
    number = Integer.parseInt(sc.next());
    int[] height = new int[number];
    for(i = 0; i < number; i++) {
      height[i] = Integer.parseInt(sc.next());
    }
    for(i = 1; i < number; i++) {
      if(height[i-1] == height[i]) continue;
      else if(height[i-1] <= height[i] - 1) height[i]--;
      else break;
    }
    if(i == number) 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 number, i;
    number = Integer.parseInt(sc.next());
    int[] height = new int[number];
    for(i = 0; i < number; i++) {
      height[i] = Integer.parseInt(sc.next());
    }
    for(i = 1; i < number; i++) {
      if(height[i-1] == height[i]) continue;
      else if(height[i-1] <= height[i] - 1) height[i]--;
      else break;
    }
    if(i == number) 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 number, i;
    number = Integer.parseInt(sc.next());
    int[] height = new int[number];
    for(i = 0; i < number; i++) {
      height[i] = Integer.parseInt(sc.next());
    }
    for(i = 1; i < number; i++) {
      if(height[i-1] == height[i]) continue;
      else if(height[i-1] <= height[i] - 1) height[i]--;
      else break;
    }
    if(i == number) System.out.println("Yes");
    else System.out.println("No");
  }
}
