#include <bits/stdc++.h>
using namespace std;
int d[202001];
int v[202001];
void dfs(int x) {
  v[x] = 1;
  if (v[d[x]] == 0) dfs(d[x]);
}
int main() {
  int n, i, aa;
  while (~scanf("%d", &n)) {
    for (i = 1; i <= n; i++) {
      cin >> aa;
      d[i] = aa;
    }
    int cc = 0;
    int res = 0;
    for (i = 1; i <= n; i++) {
      cin >> aa;
      cc += aa;
    }
    if (cc % 2 == 0) res = 1;
    memset(v, 0, sizeof(v));
    int cnt = 0;
    for (i = 1; i <= n; i++) {
      if (v[i] == 0) {
        cnt++;
        dfs(i);
      }
    }
    if (cnt == 1) cnt = 0;
    printf("%d\n", cnt + res);
  }
  return 0;
}
