func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<int> adj[100007];   int dis[100007];   void bfs() {     queue<int> q;     bool vis[100007];     memset(vis, false, sizeof(vis));     dis[1] = 1;     vis[1] = true;     q.push(1);     while (!q.empty()) {       int s = q.front();       q.pop();       for (auto u : adj[s]) {         if (vis[u]) continue;         vis[u] = true;         dis[u] = dis[s] + 1;         q.push(u);       }     }   }   void solve() {     int n;     cin >> n;     for (int i = 2; i <= n; ++i) {       int node;       cin >> node;       adj[node].emplace_back(i);     }     bfs();     set<int> st;     unordered_map<int, int> mp;     for (int i = 1; i <= n; ++i) {       st.insert(dis[i]);       mp[dis[i]]++;     }     int cnt = 0;     for (auto s : st) cnt += (mp[s] % 2);     cout << cnt;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     solve();     return 0;   }   