#include <bits/stdc++.h>
using namespace std;
const int N = 200000, INF = ~0u >> 1;
void read(int &x) {
  char ch;
  bool flag = 0;
  for (ch = getchar(); !isdigit(ch) && ((flag |= (ch == '-')) || 1);
       ch = getchar())
    ;
  for (x = 0; isdigit(ch); x = (x << 1) + (x << 3) + ch - 48, ch = getchar())
    ;
  x *= 1 - 2 * flag;
}
void print(int x) {
  if (x > 9) print(x / 10);
  putchar(x % 10 + 48);
}
void write(int x) {
  if (x < 0) putchar('-');
  print(((x) < 0 ? (-(x)) : (x)));
}
int n, f[N + 5], g[N + 5], ans, t, a[N + 5];
void work() {
  read(n);
  for (int i = 1; i <= n; i++) read(a[i]), f[i] = g[i] = INF;
  f[0] = g[0] = -INF;
  for (int i = 2; i <= n; i++) {
    t = upper_bound(f + 1, f + n + 1, a[i] - i + 1) - f;
    ans = ((ans) > (t) ? (ans) : (t));
    f[t] = a[i] - i + 1;
    t = upper_bound(g + 1, g + n + 1, a[i - 1] - i + 1) - g;
    ans = ((ans) > (t) ? (ans) : (t));
    g[t] = a[i - 1] - i + 1, f[t] = ((f[t]) < (g[t]) ? (f[t]) : (g[t]));
  }
  (write(n - 1 - ans), putchar('\n'));
}
int main() {
  work();
  return 0;
}
