func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAX = 1e5 + 5;   int minn[MAX], maxx[MAX], h[MAX];   int main() {     int n;     cin >> n;     for (int i = 1; i <= n; ++i) cin >> h[i];     int block = 1;     minn[1] = h[1];     maxx[1] = h[1];     for (int i = 2; i <= n; ++i) {       if (maxx[block] <= h[i]) {         block++;         minn[block] = h[i];         maxx[block] = h[i];       } else {         minn[block] = min(minn[block], h[i]);         maxx[block] = max(maxx[block], h[i]);         while (block > 1 && maxx[block - 1] > minn[block]) {           --block;           minn[block] = min(minn[block], minn[block + 1]);           maxx[block] = max(maxx[block], maxx[block + 1]);         }       }     }     cout << block;     return 0;   }   