#include <bits/stdc++.h>
using namespace std;
const int MAX = 2e5 + 5;
int n, p[MAX], b[MAX];
bool vis[MAX];
int main() {
  int ans = 0, cnt = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &p[i]);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &b[i]);
    if (b[i] == 1) cnt++;
  }
  if (cnt % 2 == 0) ans++;
  cnt = 0;
  memset(vis, false, sizeof(vis));
  for (int i = 1; i <= n; i++) {
    if (vis[i]) continue;
    cnt++;
    while (vis[i] == false) {
      vis[i] = true;
      i = p[i];
    }
  }
  printf("%d\n", ans + (cnt == 1 ? 0 : cnt));
  return 0;
}
