func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   vector<long long int> graph[100007];   long long int vis[100007];   long long int mxm;   void dfs(long long int u, long long int p, long long int d) {     vis[u] = 1;     mxm = max(mxm, d);     for (long long int v : graph[u]) {       dfs(v, u, d + 1);     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     long long int tc = 1;     long long int cs = 0;     while (tc--) {       long long int n;       cin >> n;       mxm = 0;       for (long long int i = 1; i <= n; i++) {         long long int a;         cin >> a;         if (a != -1) graph[a].push_back(i);       }       long long int ans = 0;       for (long long int i = 1; i <= n; i++) {         if (!vis[i]) {           dfs(i, -1, 1);           ans = max(ans, mxm);           mxm = 0;         }       }       cout << ans <<   n ;     }     return 0;   }   