func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1000000 + 239;   const int inf = (int)1e9 + 1;   const long long big = (long long)1e18 + 1;   const int P = 31;   const int MOD = (int)1e9 + 7;   const int MOD1 = (int)1e9 + 9;   const double eps = 1e-9;   const double pi = atan2(0, -1);   int a[N];   vector<int> g[N];   int d[N];   void dfs(int u) {     for (int v : g[u]) {       dfs(v);       d[u] = max(d[u], d[v] + 1);     }   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.precision(20);     int n;     cin >> n;     for (int i = 0; i < n; i++) cin >> a[i];     for (int i = 1; i < n; i++) {       int p;       cin >> p;       p--;       g[p].push_back(i);     }     dfs(0);     int res = 0;     for (int i = 0; i < n; i++)       if (d[i] % 2 == 0) res ^= a[i];     map<int, int> cnt;     for (int i = 0; i < n; i++)       if (d[i] % 2 == 1) cnt[a[i]]++;     long long ans = 0;     for (int i = 0; i < n; i++)       if (d[i] % 2 == 0) ans += cnt[res ^ a[i]];     if (res == 0) {       int cnt0 = 0, cnt1 = 0;       for (int i = 0; i < n; i++)         if (d[i] % 2 == 0)           cnt0++;         else           cnt1++;       ans += (long long)cnt0 * (cnt0 - 1) / 2;       ans += (long long)cnt1 * (cnt1 - 1) / 2;     }     cout << ans << endl;     return 0;   }   