func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, leaf;   vector<int> vt[100005];   int ara[100005], chk[100005], level[100005], child[100005];   map<int, int> mp;   void bfs() {     int i, j, k;     queue<int> qu;     qu.push(0);     chk[0] = 1;     level[0] = 0;     while (!qu.empty()) {       k = qu.front();       qu.pop();       for (i = 0; i < vt[k].size(); ++i) {         j = vt[k][i];         if (!chk[j]) {           qu.push(j);           level[j] = level[k] + 1;           chk[j] = 1;         }       }     }   }   int main() {     long long i, j, k;     long long xr, ans;     scanf( %d , &n);     for (i = 0; i < n; ++i) scanf( %d , &ara[i]);     for (i = 1; i < n; ++i) {       scanf( %d , &k);       k--;       child[k] = 1;       vt[i].push_back(k);       vt[k].push_back(i);     }     bfs();     for (i = 0; i < n; ++i)       if (!child[i]) leaf = i;     for (i = 0, xr = 0, k = n; i < n; ++i) {       if (level[leaf] % 2 == level[i] % 2) xr ^= ara[i], k--, mp[ara[i]]++;       ;     }     ans = 0;     if (xr == 0) {       ans += (k * (k - 1)) / 2;       k = n - k;       ans += (k * (k - 1)) / 2;       for (i = 0; i < n; ++i) {         if (level[leaf] % 2 != level[i] % 2) ans += mp[ara[i]];       }     } else {       for (i = 0; i < n; ++i) {         if (level[leaf] % 2 == level[i] % 2) continue;         k = xr ^ ara[i];         ans += mp[k];       }     }     cout << ans << endl;   }   