#include <bits/stdc++.h>
using namespace std;
int p[200200];
int b[200200];
bool vis[200200];
void dfs(int x) {
  vis[x] = true;
  if (!vis[p[x]]) dfs(p[x]);
}
int main() {
  int n;
  cin >> n;
  int sum = 0;
  for (int i = 1; i <= n; i++) cin >> p[i];
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    sum += b[i];
  }
  int ans = 0;
  if (!(sum % 2)) ans++;
  int cyc = 0;
  for (int i = 1; i <= n; i++) {
    if (vis[i]) continue;
    cyc++;
    dfs(i);
  }
  if (cyc == 1) cyc = 0;
  cout << ans + cyc << '\n';
  return 0;
}
