func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAX = 1e5 + 7;   int clr[MAX] = {0}, vis[MAX] = {0}, res = 0;   vector<int> adj[MAX];   void dfs(int u, int p, int clr_p) {     int f = 0;     if (!vis[clr[u]]) {       f = 1;       vis[clr[u]] = 1;       res++;     } else if (p != -1 && clr_p != clr[u])       res++;     for (int i = 0; i < adj[u].size(); i++) {       int v = adj[u][i];       if (p == v) continue;       dfs(v, u, clr[u]);     }     if (f) vis[clr[u]] = 0;   }   int main(int argc, char const *argv[]) {     int n, x;     cin >> n;     for (int i = 2; i <= n; i++) {       cin >> x;       adj[i].push_back(x);       adj[x].push_back(i);     }     for (int i = 1; i <= n; i++) cin >> clr[i];     dfs(1, -1, -1);     std::cout << res <<   n ;     return 0;   }   