func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long N = 200411;   vector<int> root;   int now, n, s[N], p[N], toghe;   void dfs(int v) {     if (s[v]) {       if (s[v] == now) root.push_back(v);       return;     }     s[v] = now;     dfs(p[v]);   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d , &p[i]);       if (p[i] == i) toghe = i;     }     for (int i = 1; i <= n; i++) {       now = i;       if (!s[i]) dfs(i);     }     cout << root.size() - (toghe > 0) << endl;     if (toghe == 0) toghe = root[0];     for (int i = 0; i < root.size(); i++) p[root[i]] = toghe;     for (int i = 1; i <= n; i++) printf( %d  , p[i]);   }   