func_code_string: #include <bits/stdc++.h>   using namespace std;   using cd = complex<double>;   const int Inf = 1000000007;   const long long mod = 1000000007;   const double Pi = acos(-1);   void Fastio() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);   }   int n, t, ans = 0;   long long res = 0;   int Co[4], Color[100005], a[100005];   vector<int> Adj[100005];   map<int, long long> C;   int main() {     Fastio();     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> a[i];     }     for (int j = 2; j <= n; j++) {       int temp;       cin >> temp;       Adj[temp].emplace_back(j);       Adj[j].emplace_back(temp);     }     queue<int> BFS;     BFS.push(1);     Co[1] = 1;     Color[1] = 1;     while (BFS.empty() == false) {       int node = BFS.front();       for (auto x : Adj[node]) {         if (!Color[x]) {           Color[x] = 3 - Color[node];           Co[Color[x]]++;           BFS.push(x);         }       }       BFS.pop();     }     for (int i = 1; i <= n; i++) {       if (Adj[i].size() == 1 and i != 1) {         t = Color[i];         break;       }     }     t = 3 - t;     for (int i = 1; i <= n; i++) {       if (Color[i] == 3 - t) {         ans ^= a[i];         C[a[i]]++;       }     }     if (ans == 0) {       res += 1ll * Co[3 - t] * (Co[3 - t] - 1) / 2;       res += 1ll * Co[t] * (Co[t] - 1) / 2;     }     for (int i = 1; i <= n; i++) {       if (Color[i] == t) {         res += C[a[i] ^ ans];       }     }     cout << res;   }   