func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 2000;   int pre[maxn];   int countlen(int i) {     int ans = 0, p;     for (p = i; p != -2; p = pre[p]) ans++;     return ans;   }   int main() {     int i, n;     cin >> n;     for (i = 0; i < n; i++) cin >> pre[i], pre[i]--;     int ans = 0;     for (i = 0; i < n; i++) ans = max(ans, countlen(i));     cout << ans << endl;     return 0;   }   