func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAX_N = 2e3;   vector<int> e[MAX_N], d;   vector<char> flag;   void dfs(int v) {     if (d[v] != -1) return;     d[v] = 1;     for (int to : e[v]) {       dfs(to);       d[v] = max(d[v], d[to] + 1);     }   }   int main() {     int n;     scanf( %d , &n);     d.assign(n, -1);     for (int i = 0; i < n; i++) {       int x;       scanf( %d , &x);       if (x != -1) e[x - 1].push_back(i);     }     for (int i = 0; i < n; i++)       if (d[i] == -1) dfs(i);     int ans = 1;     for (int i : d) ans = max(ans, i);     printf( %d , ans);     return 0;   }   