import java.util.Scanner;

public class Main {
  private static void solve(int n, int[] h) {
    h[0]--;
    for (int i = 1; i < n; i++) {
      if (h[i - 1] > h[i]) {
        System.out.println("No");
        return;
      }
      h[i] = Math.max(h[i - 1], h[i] - 1);
    }
    System.out.println("Yes");
  }
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.nextLine());
    String[] hs = sc.nextLine().split(" ");
    sc.close();
    int[] h = new int[n];
    for (int i = 0; i < n; i++) {
      h[i] = Integer.parseInt(hs[i]);
    }
    solve(n, h);
  }
} import java.util.Scanner; Scanner java.util public class Main {
  private static void solve(int n, int[] h) {
    h[0]--;
    for (int i = 1; i < n; i++) {
      if (h[i - 1] > h[i]) {
        System.out.println("No");
        return;
      }
      h[i] = Math.max(h[i - 1], h[i] - 1);
    }
    System.out.println("Yes");
  }
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.nextLine());
    String[] hs = sc.nextLine().split(" ");
    sc.close();
    int[] h = new int[n];
    for (int i = 0; i < n; i++) {
      h[i] = Integer.parseInt(hs[i]);
    }
    solve(n, h);
  }
} Main private static void solve(int n, int[] h) {
    h[0]--;
    for (int i = 1; i < n; i++) {
      if (h[i - 1] > h[i]) {
        System.out.println("No");
        return;
      }
      h[i] = Math.max(h[i - 1], h[i] - 1);
    }
    System.out.println("Yes");
  } solve {
    h[0]--;
    for (int i = 1; i < n; i++) {
      if (h[i - 1] > h[i]) {
        System.out.println("No");
        return;
      }
      h[i] = Math.max(h[i - 1], h[i] - 1);
    }
    System.out.println("Yes");
  } h[0]-- h[0] h 0 for (int i = 1; i < n; i++) {
      if (h[i - 1] > h[i]) {
        System.out.println("No");
        return;
      }
      h[i] = Math.max(h[i - 1], h[i] - 1);
    } int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
      if (h[i - 1] > h[i]) {
        System.out.println("No");
        return;
      }
      h[i] = Math.max(h[i - 1], h[i] - 1);
    } {
      if (h[i - 1] > h[i]) {
        System.out.println("No");
        return;
      }
      h[i] = Math.max(h[i - 1], h[i] - 1);
    } if (h[i - 1] > h[i]) {
        System.out.println("No");
        return;
      } h[i - 1] > h[i] h[i - 1] h i - 1 i 1 h[i] h i {
        System.out.println("No");
        return;
      } System.out.println("No") System.out.println System.out System System.out "No" return; h[i] = Math.max(h[i - 1], h[i] - 1) h[i] h i Math.max(h[i - 1], h[i] - 1) Math.max Math h[i - 1] h i - 1 i 1 h[i] - 1 h[i] h i 1 System.out.println("Yes") System.out.println System.out System System.out "Yes" int n n int[] h h public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.nextLine());
    String[] hs = sc.nextLine().split(" ");
    sc.close();
    int[] h = new int[n];
    for (int i = 0; i < n; i++) {
      h[i] = Integer.parseInt(hs[i]);
    }
    solve(n, h);
  } main {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.nextLine());
    String[] hs = sc.nextLine().split(" ");
    sc.close();
    int[] h = new int[n];
    for (int i = 0; i < n; i++) {
      h[i] = Integer.parseInt(hs[i]);
    }
    solve(n, h);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.nextLine()); n Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc String[] hs = sc.nextLine().split(" "); hs sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " sc.close() sc.close sc int[] h = new int[n]; h new int[n] n for (int i = 0; i < n; i++) {
      h[i] = Integer.parseInt(hs[i]);
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
      h[i] = Integer.parseInt(hs[i]);
    } {
      h[i] = Integer.parseInt(hs[i]);
    } h[i] = Integer.parseInt(hs[i]) h[i] h i Integer.parseInt(hs[i]) Integer.parseInt Integer hs[i] hs i solve(n, h) solve n h String[] args args public class Main {
  private static void solve(int n, int[] h) {
    h[0]--;
    for (int i = 1; i < n; i++) {
      if (h[i - 1] > h[i]) {
        System.out.println("No");
        return;
      }
      h[i] = Math.max(h[i - 1], h[i] - 1);
    }
    System.out.println("Yes");
  }
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.nextLine());
    String[] hs = sc.nextLine().split(" ");
    sc.close();
    int[] h = new int[n];
    for (int i = 0; i < n; i++) {
      h[i] = Integer.parseInt(hs[i]);
    }
    solve(n, h);
  }
} public class Main {
  private static void solve(int n, int[] h) {
    h[0]--;
    for (int i = 1; i < n; i++) {
      if (h[i - 1] > h[i]) {
        System.out.println("No");
        return;
      }
      h[i] = Math.max(h[i - 1], h[i] - 1);
    }
    System.out.println("Yes");
  }
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.nextLine());
    String[] hs = sc.nextLine().split(" ");
    sc.close();
    int[] h = new int[n];
    for (int i = 0; i < n; i++) {
      h[i] = Integer.parseInt(hs[i]);
    }
    solve(n, h);
  }
} Main
import java.util.Scanner;

public class Main {
  private static void solve(int n, int[] h) {
    h[0]--;
    for (int i = 1; i < n; i++) {
      if (h[i - 1] > h[i]) {
        System.out.println("No");
        return;
      }
      h[i] = Math.max(h[i - 1], h[i] - 1);
    }
    System.out.println("Yes");
  }
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.nextLine());
    String[] hs = sc.nextLine().split(" ");
    sc.close();
    int[] h = new int[n];
    for (int i = 0; i < n; i++) {
      h[i] = Integer.parseInt(hs[i]);
    }
    solve(n, h);
  }
}