#include <bits/stdc++.h>
using namespace std;
int vet[200010];
int marc[200010];
int main() {
  int n;
  int resp = 0;
  int a = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &vet[i]);
  }
  for (int i = 1; i <= n; i++) {
    int b;
    scanf("%d", &b);
    a += b;
  }
  if (a % 2 == 0) {
    resp++;
  }
  int cic = 0;
  for (int i = 1; i <= n; i++) {
    if (!marc[i]) {
      cic++;
      int a = i;
      while (!marc[a]) {
        marc[a] = 1;
        a = vet[a];
      }
    }
  }
  if (cic > 1) resp += cic;
  printf("%d\n", resp);
  return 0;
}
