func_code_string: #include <bits/stdc++.h>   using namespace std;   int a[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};   int n, m, k;   int q(int x) { return x * (x + 1) / 2; }   int p[200005];   int b[200005];   int u[200005];   int dfs(int v) {     u[v] = 1;     if (!u[p[v]])       return dfs(p[v]) + 1;     else       return 1;   }   int solve() {     int n;     cin >> n;     for (int i = 0; i < n; ++i) {       scanf( %d , &p[i + 1]);     }     int c = 0;     for (int i = 0; i < n; ++i) {       scanf( %d , &b[i + 1]);       c += b[i + 1];     }     if (n == 1) {       cout << (c + 1) % 2;       return 0;     }     int res = 0;     int ones = 0;     for (int i = 1; i <= n; ++i)       if (!u[i]) {         int k = dfs(i);         if (k == 1)           ++ones;         else           ++res;       }     if (res == 1 && ones == 0) {       cout << (c + 1) % 2;       return 0;     }     if (res == 0)       cout << ones + (c + 1) % 2;     else if (ones == 0)       cout << res + (c + 1) % 2;     else       cout << res + ones + (c + 1) % 2;     return 0;   }   int main() {     int t = 1;     while (t--) {       solve();     }     return 0;   }   