#include <bits/stdc++.h>
int n, cnt, mid, ans, init, tra;
int p[1000000], vis[1000000];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &p[i + 1]);
  cnt = 1;
  for (int i = 0; i < n; i++) {
    scanf("%d", &mid);
    cnt = (cnt + mid) % 2;
  }
  ans += cnt;
  int cir = 0;
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) {
      cir++;
      init = i;
      vis[i] = 1;
      tra = p[i];
      while (tra != init) {
        vis[tra] = 1;
        tra = p[tra];
      }
    }
  }
  if (cir > 1) {
    ans += cir;
  }
  printf("%d\n", ans);
  return 0;
}
