#include <bits/stdc++.h>
using namespace std;
const int M = 2e5 + 44;
int a[M];
int flag[M];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int nn = 0;
  for (int i = 1; i <= n; i++) {
    int b;
    cin >> b;
    if (b & 1) nn++;
  }
  int ans = 0;
  if (nn % 2 == 0) ans++;
  nn = 0;
  for (int i = 1; i <= n; i++) {
    int w = i;
    if (flag[w] == 0) nn++;
    while (flag[w] == 0) {
      flag[w] = 1;
      w = a[w];
    }
  }
  if (nn == 1) {
    int w = 1;
    int p = 0;
    while (w) {
      w = a[w];
      if (w == 1) {
        cout << ans << endl;
        return 0;
      }
      p++;
      if (p > n + 44) break;
    }
  }
  cout << ans + nn << endl;
  return 0;
}
