func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 2e5;   vector<int> g[N];   int deg[N];   int cnt[N];   void dfs(int v, int &l) {     for (int i = 0; i < g[v].size(); i++) {       cnt[g[v][i]] = l + 1;       l++;       dfs(g[v][i], l);       l--;     }   }   int main() {     ios_base::sync_with_stdio(), cout.tie(NULL), cin.tie(NULL);     ;     int n;     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> deg[i];       if (deg[i] != -1) {         g[deg[i]].push_back(i);       }     }     int ans = 1;     for (int i = 1; i <= n; i++) {       if (deg[i] == -1) {         int level = 1;         dfs(i, level);       }     }     for (int i = 1; i <= n; i++) {       ans = max(ans, cnt[i]);     }     cout << ans << endl;   }   