func_code_string: #include <bits/stdc++.h>   using namespace std;   pair<long long int, pair<int, bool> > p[200005 << 1];   long long int a[200005], tree[200005 << 2][2];   long long int get(int n, int b, int e, int i, int j, bool c) {     if (i > j || j < b || e < i) return 0;     if (i <= b && j >= e) return tree[n][c];     int l, r, m;     m = (b + e) >> 1;     l = (n << 1) + 1;     r = l + 1;     return max(get(l, b, m, i, j, c), get(r, m + 1, e, i, j, c));   }   void update(int n, int b, int e, int i, long long int v, bool c) {     if (i < b || i > e) return;     if (b == e) {       tree[n][c] = v;       return;     }     int l, r, m;     m = (b + e) >> 1;     l = (n << 1) + 1;     r = l + 1;     update(l, b, m, i, v, c);     update(r, m + 1, e, i, v, c);     tree[n][c] = max(tree[l][c], tree[r][c]);   }   int main() {     int n;     long long int t;     scanf( %d , &n);     for (int i = 0; i < n; i++) {       scanf( %lld , &a[i]);       p[i] = make_pair(a[i] - i, make_pair(i, 1));       if (i > 0) p[i + n - 1] = make_pair(a[i] - i + 1, make_pair(i - 1, 0));     }     int m = 2 * n - 1;     sort(p, p + m);     for (int i = 0; i < m; i++) {       t = get(0, 0, n - 1, 0, p[i].second.first - 1, 1);       if (!p[i].second.second)         t = max(t, get(0, 0, n - 1, 0, p[i].second.first - 1, 0));       update(0, 0, n - 1, p[i].second.first, t + 1, p[i].second.second);     }     printf( %lld n , max(0ll, n - 1 - max(tree[0][1], tree[0][0])));     return 0;   }   