#include <bits/stdc++.h>
using namespace std;
const long long MAX_N = 200000 + 10, mod = 1000000007;
long long n, p[MAX_N], b[MAX_N], ans, z;
bool mark[MAX_N];
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> p[i + 1];
  }
  for (long long i = 0; i < n; i++) {
    cin >> b[i];
    z += b[i];
    z %= 2;
  }
  if (z == 0)
    z++;
  else
    z = 0;
  for (long long i = 1; i <= n; i++) {
    if (!mark[i]) {
      ans++;
      long long x = i;
      while (!mark[x]) mark[x] = 1, x = p[x];
    }
  }
  if (ans == 1)
    cout << z;
  else
    cout << ans + z;
  return 0;
}
