func_code_string: #include <bits/stdc++.h>   using namespace std;   #pragma comment(linker,  /STACK:102400000,102400000 )   const int N = 100005;   long long ans;   int n, a[N], pi;   vector<int> G[N];   int s[2], flag, cnt[2];   map<int, int> mp[2];   void upd(int u, int dep) {     if ((dep % 2) != (flag % 2)) {       s[flag ^ 1] ^= a[u];       mp[flag ^ 1][a[u]]++;       ++cnt[flag ^ 1];     } else {       s[flag] ^= a[u];       mp[flag][a[u]]++;       ++cnt[flag];     }   }   void dfs(int u, int fa, int dep) {     if (G[u].size() == 1 && u != 1) {       if ((dep & 1) && flag == 0) flag ^= 1;     }     for (auto to : G[u])       if (to != fa) dfs(to, u, dep + 1);     upd(u, dep);   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; ++i) scanf( %d , &a[i]);     for (int i = 2; i <= n; ++i) {       scanf( %d , &pi);       G[pi].push_back(i);       G[i].push_back(pi);     }     dfs(1, 0, 0);     if (s[flag] == 0) {       if (cnt[flag] > 1) ans += 1LL * cnt[flag] * (cnt[flag] - 1) / 2;       if (cnt[flag ^ 1] > 1) ans += 1LL * cnt[flag ^ 1] * (cnt[flag ^ 1] - 1) / 2;       for (auto it = mp[flag].begin(); it != mp[flag].end(); ++it) {         int tmp1 = it->first, tmp2 = it->second, tmp3 = mp[flag ^ 1][tmp1];         ans += 1LL * tmp2 * tmp3;       }     } else {       for (auto it = mp[flag].begin(); it != mp[flag].end(); ++it) {         int tmp1 = it->first, tmp2 = it->second,             tmp3 = mp[flag ^ 1][s[flag] ^ tmp1];         ans += 1LL * tmp2 * tmp3;       }     }     printf( %lld n , ans);     return 0;   }   