#include <bits/stdc++.h>
int A[200005], f[2][200005], n, a, b, l;
int main() {
  std::cin >> n;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", A + i);
    A[i] -= i + 200005;
  }
  for (int i = 1; i < n; ++i) {
    l = std::upper_bound(f[1], f[1] + b, A[i + 1] + 1) - f[1];
    f[1][l] = A[i + 1] + 1;
    if (l + 1 > b) b = l + 1;
    l = std::upper_bound(f[0], f[0] + a, A[i]) - f[0];
    if (f[1][l] > (f[0][l] = A[i])) f[1][l] = A[i];
    if (l + 1 > a) a = l + 1;
  }
  if (a > b) b = a;
  return !printf("%d\n", n - 1 - b);
}
