#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
int lowbit(int x) { return x & -x; }
const int N = 200000;
int n;
int a[N + 2], ami[N + 2], amip1[N + 2];
vector<int> nums;
void discrete() {
  sort(nums.begin(), nums.end());
  nums.resize(unique(nums.begin(), nums.end()) - nums.begin());
  for (int i = 0; i <= n + 1; i++)
    a[i] = lower_bound(nums.begin(), nums.end(), a[i]) - nums.begin() + 1;
  for (int i = 0; i <= n + 1; i++)
    ami[i] = lower_bound(nums.begin(), nums.end(), ami[i]) - nums.begin() + 1;
  for (int i = 0; i <= n + 1; i++)
    amip1[i] =
        lower_bound(nums.begin(), nums.end(), amip1[i]) - nums.begin() + 1;
}
struct bitree {
  int mx[3 * N + 7];
  void init() {
    for (int i = 1; i <= nums.size(); i++) mx[i] = -inf;
  }
  void insert(int x, int v) {
    while (x <= nums.size()) mx[x] = max(mx[x], v), x += lowbit(x);
  }
  int Mx(int x) {
    int res = -inf;
    while (x) res = max(res, mx[x]), x -= lowbit(x);
    return res;
  }
} bit0, bit1, bit2;
int dp0[N + 2], dp1[N + 2];
int main() {
  cin >> n;
  nums.push_back(0);
  for (int i = 1; i <= n; i++)
    scanf("%d", a + i), nums.push_back(a[i]), nums.push_back(ami[i] = a[i] - i),
        nums.push_back(amip1[i] = a[i] - i + 1);
  nums.push_back(a[n + 1] = inf), nums.push_back(ami[n + 1] = a[n + 1] - n - 1),
      nums.push_back(amip1[n + 1] = a[n + 1] - n - 1 + 1);
  nums.push_back(a[0] = -inf), nums.push_back(ami[0] = a[0] - 0),
      nums.push_back(amip1[0] = a[0] - 0 + 1);
  discrete();
  bit0.init(), bit1.init(), bit2.init();
  for (int i = 1; i <= n + 1; i++) {
    bit0.insert(ami[i - 1], dp0[i - 1]);
    bit1.insert(ami[i - 1], dp1[i - 1]);
    if (i >= 2) bit2.insert(ami[i - 2], dp0[i - 2]);
    dp0[i] = bit0.Mx(ami[i]) + 1;
    dp1[i] = max(bit1.Mx(ami[i]) + 1, bit2.Mx(amip1[i]) + 2);
  }
  int ans = max(dp0[n + 1], dp1[n + 1]);
  cout << n + 1 - ans;
  return 0;
}
