func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 100005;   int n, a[maxn], b[maxn], v[maxn];   unordered_map<int, int> mp;   void dfs(int x, int l, int r) {     if (v[x] <= r && v[x] >= l) mp[v[x]] = 1;     if (a[x] != -1) {       if (l < v[x]) dfs(a[x], l, min(v[x] - 1, r));     }     if (b[x] != -1) {       if (r > v[x]) dfs(b[x], max(l, v[x] + 1), r);     }   }   bool f[maxn];   int main() {     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> v[i] >> a[i] >> b[i];       if (a[i] != -1) f[a[i]] = 1;       if (b[i] != -1) f[b[i]] = 1;     }     int root = 1;     for (int i = 1; i <= n; i++)       if (!f[i]) root = i;     dfs(root, 0, 1000000000);     int ret = 0;     for (int i = 1; i <= n; i++)       if (mp.find(v[i]) != mp.end()) ret++;     cout << n - ret << endl;     return 0;   }   