import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner scn = new Scanner(System.in);
    int N = scn.nextInt();

    int[] H = new int[N];
    for (int i = 0; i < N; i++) {
      H[i] = scn.nextInt();
    }

    boolean flg = true;
    for (int i = N - 2; i >= 0; i--) {
      if (H[i] - H[i + 1] > 1) {
        flg = false;
        break;
      }

      if (H[i] - H[i + 1] == 1) {
        H[i]--;
      }
    }

    System.out.println(flg ? "Yes" : "No");
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner scn = new Scanner(System.in);
    int N = scn.nextInt();

    int[] H = new int[N];
    for (int i = 0; i < N; i++) {
      H[i] = scn.nextInt();
    }

    boolean flg = true;
    for (int i = N - 2; i >= 0; i--) {
      if (H[i] - H[i + 1] > 1) {
        flg = false;
        break;
      }

      if (H[i] - H[i + 1] == 1) {
        H[i]--;
      }
    }

    System.out.println(flg ? "Yes" : "No");
  }
} Main public static void main(String[] args) {
    Scanner scn = new Scanner(System.in);
    int N = scn.nextInt();

    int[] H = new int[N];
    for (int i = 0; i < N; i++) {
      H[i] = scn.nextInt();
    }

    boolean flg = true;
    for (int i = N - 2; i >= 0; i--) {
      if (H[i] - H[i + 1] > 1) {
        flg = false;
        break;
      }

      if (H[i] - H[i + 1] == 1) {
        H[i]--;
      }
    }

    System.out.println(flg ? "Yes" : "No");
  } main {
    Scanner scn = new Scanner(System.in);
    int N = scn.nextInt();

    int[] H = new int[N];
    for (int i = 0; i < N; i++) {
      H[i] = scn.nextInt();
    }

    boolean flg = true;
    for (int i = N - 2; i >= 0; i--) {
      if (H[i] - H[i + 1] > 1) {
        flg = false;
        break;
      }

      if (H[i] - H[i + 1] == 1) {
        H[i]--;
      }
    }

    System.out.println(flg ? "Yes" : "No");
  } Scanner scn = new Scanner(System.in); scn new Scanner(System.in) int N = scn.nextInt(); N scn.nextInt() scn.nextInt scn int[] H = new int[N]; H new int[N] N for (int i = 0; i < N; i++) {
      H[i] = scn.nextInt();
    } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
      H[i] = scn.nextInt();
    } {
      H[i] = scn.nextInt();
    } H[i] = scn.nextInt() H[i] H i scn.nextInt() scn.nextInt scn boolean flg = true; flg true for (int i = N - 2; i >= 0; i--) {
      if (H[i] - H[i + 1] > 1) {
        flg = false;
        break;
      }

      if (H[i] - H[i + 1] == 1) {
        H[i]--;
      }
    } int i = N - 2; int i = N - 2; i N - 2 N 2 i >= 0 i 0 i-- i-- i {
      if (H[i] - H[i + 1] > 1) {
        flg = false;
        break;
      }

      if (H[i] - H[i + 1] == 1) {
        H[i]--;
      }
    } {
      if (H[i] - H[i + 1] > 1) {
        flg = false;
        break;
      }

      if (H[i] - H[i + 1] == 1) {
        H[i]--;
      }
    } if (H[i] - H[i + 1] > 1) {
        flg = false;
        break;
      } H[i] - H[i + 1] > 1 H[i] - H[i + 1] H[i] H i H[i + 1] H i + 1 i 1 1 {
        flg = false;
        break;
      } flg = false flg false break; if (H[i] - H[i + 1] == 1) {
        H[i]--;
      } H[i] - H[i + 1] == 1 H[i] - H[i + 1] H[i] H i H[i + 1] H i + 1 i 1 1 {
        H[i]--;
      } H[i]-- H[i] H i System.out.println(flg ? "Yes" : "No") System.out.println System.out System System.out flg ? "Yes" : "No" flg "Yes" "No" String[] args args public class Main {
  public static void main(String[] args) {
    Scanner scn = new Scanner(System.in);
    int N = scn.nextInt();

    int[] H = new int[N];
    for (int i = 0; i < N; i++) {
      H[i] = scn.nextInt();
    }

    boolean flg = true;
    for (int i = N - 2; i >= 0; i--) {
      if (H[i] - H[i + 1] > 1) {
        flg = false;
        break;
      }

      if (H[i] - H[i + 1] == 1) {
        H[i]--;
      }
    }

    System.out.println(flg ? "Yes" : "No");
  }
} public class Main {
  public static void main(String[] args) {
    Scanner scn = new Scanner(System.in);
    int N = scn.nextInt();

    int[] H = new int[N];
    for (int i = 0; i < N; i++) {
      H[i] = scn.nextInt();
    }

    boolean flg = true;
    for (int i = N - 2; i >= 0; i--) {
      if (H[i] - H[i + 1] > 1) {
        flg = false;
        break;
      }

      if (H[i] - H[i + 1] == 1) {
        H[i]--;
      }
    }

    System.out.println(flg ? "Yes" : "No");
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner scn = new Scanner(System.in);
    int N = scn.nextInt();

    int[] H = new int[N];
    for (int i = 0; i < N; i++) {
      H[i] = scn.nextInt();
    }

    boolean flg = true;
    for (int i = N - 2; i >= 0; i--) {
      if (H[i] - H[i + 1] > 1) {
        flg = false;
        break;
      }

      if (H[i] - H[i + 1] == 1) {
        H[i]--;
      }
    }

    System.out.println(flg ? "Yes" : "No");
  }
}