func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int temp[100012], arr[100012], t[100012];     for (int i = 0; i < n; i++) {       cin >> arr[i];       t[i] = arr[i];     }     sort(t, t + n);     int v = 0;     for (int i = 0; i < n; i++) {       if (t[i] != arr[i]) {         v = 1;         break;       }     }     if (v == 0) {       cout << n << endl;       return 0;     }     int c = 0;     for (int i = 0; i < n; i++) {       if (arr[i] == i)         c++;       else {         temp[i] = arr[i];       }     }     int f = 0;     for (int i = 0; i < n; i++) {       if (arr[i] != i) {         if (i == temp[temp[i]]) {           c += 2;           f = 1;           break;         }       }     }     if (f == 0) c += 1;     if (c > n) c = n;     cout << c << endl;   }   