func_code_string: #include <bits/stdc++.h>   using namespace std;   const int INF = INT_MAX;   int n, root = 0;   vector<vector<int>> adj;   vector<int> d;   void dfs() {     d.assign(n, INF);     d[root] = 0;     queue<int> q;     q.push(root);     while (!q.empty()) {       int cur = q.front();       q.pop();       for (auto nxt : adj[cur])         if (d[nxt] == INF) {           d[nxt] = 1 + d[cur];           q.push(nxt);         }     }   }   int main() {     cin >> n;     adj.resize(n);     for (int i = 1; i < n; i++) {       int p;       cin >> p;       p -= 1;       adj[i].push_back(p);       adj[p].push_back(i);     }     dfs();     vector<int> cnt(n, 0);     for (int i = 0; i < n; i++) cnt[d[i]] += 1;     int res = 0;     for (int i = 0; i < n; i++) res += (cnt[i] & 1);     cout << res << endl;   }   