#include <bits/stdc++.h>
using namespace std;
const int N = (int)2e5 + 10, INF = (int)1e9 + (int)2e5 + 7;
int a[N], n, p[N], psiz;
int dp1[N], dp2[N], v[N];
void process() {
  int len = 0;
  fill(v + 1, v + n + 1, INF);
  v[0] = -INF;
  dp1[0] = 0;
  for (int i = 1; i <= n; i++) {
    int p = upper_bound(v, v + len + 1, a[i]) - v;
    dp1[i] = p;
    v[p] = min(v[p], a[i]);
    if (p > len) len = p;
  }
  fill(v + 1, v + n + 1, -INF);
  v[0] = INF;
  dp2[n + 1] = 0;
  len = 0;
  for (int i = n; i >= 1; i--) {
    int p = upper_bound(v, v + len + 1, a[i], greater<int>()) - v;
    dp2[i] = p;
    v[p] = max(v[p], a[i]);
    if (p > len) len = p;
  }
}
struct BIT {
  int m[N], n;
  void init(int n) {
    this->n = n;
    memset(m, 0, sizeof(m));
  }
  void update(int i, int v) {
    for (; i <= n; i += i & (-i)) m[i] = max(m[i], v);
  }
  int get(int i) {
    int v = 0;
    for (; i; i -= i & (-i)) v = max(v, m[i]);
    return v;
  }
} bit;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
    a[i] -= i;
  }
  process();
  set<int> ts(a + 1, a + n + 1);
  for (int v : ts) p[++psiz] = v;
  bit.init(psiz);
  int ans = 0;
  for (int i = 1; i < n; i++) {
    ans = max(ans, dp1[i]);
    ans = max(ans, dp2[i + 1] +
                       bit.get(upper_bound(p + 1, p + psiz + 1, a[i + 1] + 1) -
                               p - 1));
    bit.update(lower_bound(p + 1, p + psiz + 1, a[i]) - p, dp1[i]);
  }
  printf("%d\n", n - 1 - ans);
}
