func_code_string: #include <bits/stdc++.h>   using namespace std;   pair<int, int> Castle[100010];   int Index[100010];   int main() {     int N;     scanf( %d , &N);     int Temp;     for (int i = 1; i <= N; i++) {       scanf( %d , &Temp);       Castle[i] = make_pair(Temp, i);     }     sort(Castle + 1, Castle + N + 1);     int Max = 1;     int Ans = 0;     for (int i = 1; i <= N; i++) Index[Castle[i].second] = i;     for (int i = 1; i <= N; i++) {       Max = max(Max, Index[i]);       if (Max == i) Ans++;     }     printf( %d n , Ans);     return 0;   }   