func_code_string: #include <bits/stdc++.h>   using namespace std;   const int nmax = 1e7 + 5;   int cnt[2][nmax];   int valu[100005];   vector<int> g[100005];   int liflevel;   int koyta[2];   void dfs(int u, int level = 0) {     cnt[level % 2][valu[u]]++;     koyta[level % 2]++;     for (int v : g[u]) dfs(v, level + 1);     if (g[u].empty()) liflevel = level % 2;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int n;     cin >> n;     for (int i = 1; i <= n; i++) cin >> valu[i];     for (int i = 2; i <= n; i++) {       int p;       cin >> p;       g[p].push_back(i);     }     dfs(1);     int jor = 0;     long long ans = 0;     for (int i = 0; i < nmax; i++)       if (cnt[liflevel][i] % 2) jor ^= i;     if (jor) {       for (int i = 0; i < nmax; i++) {         int tmp = jor ^ i;         if (tmp < nmax) ans += 1LL * cnt[liflevel][i] * cnt[liflevel ^ 1][tmp];       }     } else {       ans += 1LL * koyta[0] * (koyta[0] - 1) / 2 +              1LL * koyta[1] * (koyta[1] - 1) / 2;       for (int i = 0; i < nmax; i++) ans += 1LL * cnt[0][i] * cnt[1][i];     }     cout << ans;   }   