#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
int n, a[MAXN];
vector<int> v;
int tree[4 * MAXN][2];
void change(int i, int L, int R, int k, int f, int v) {
  if (k < L || R < k) return;
  if (L == R) {
    tree[i][f] = v;
    return;
  }
  int mid = (L + R) / 2;
  change(2 * i, L, mid, k, f, v);
  change(2 * i + 1, mid + 1, R, k, f, v);
  tree[i][f] = max(tree[2 * i][f], tree[2 * i + 1][f]);
}
int query(int i, int L, int R, int x, int f) {
  if (v[R] <= x) return tree[i][f];
  if (v[L] > x) return 0;
  int mid = (L + R) / 2;
  return max(query(2 * i, L, mid, x, f), query(2 * i + 1, mid + 1, R, x, f));
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    a[i] -= i;
    v.push_back(a[i]);
  }
  sort(v.begin(), v.end());
  v.resize(unique(v.begin(), v.end()) - v.begin());
  int m = v.size();
  int p0 = -1, p1 = -1;
  for (int i = 0; i < n; i++) {
    int f1 = 1 + query(1, 0, m - 1, a[i] + 1, 0);
    if (i > 0) {
      int d = lower_bound(v.begin(), v.end(), a[i - 1]) - v.begin();
      change(1, 0, m - 1, d, 0, p0);
      change(1, 0, m - 1, d, 1, p1);
    }
    int f0 = 1 + query(1, 0, m - 1, a[i], 0);
    f1 = max(f1, 1 + query(1, 0, m - 1, a[i], 1));
    p0 = f0;
    p1 = f1;
  }
  int d = lower_bound(v.begin(), v.end(), a[n - 1]) - v.begin();
  change(1, 0, m - 1, d, 0, p0);
  change(1, 0, m - 1, d, 1, p1);
  printf("%d\n", n - min(n, tree[1][1] + 1));
  return 0;
}
