#include <bits/stdc++.h>
using namespace std;
const int maxN = 2e5 + 10;
int p[maxN], n;
bool mark[maxN];
void dfs(int v) {
  mark[v] = true;
  if (!mark[p[v]]) dfs(p[v]);
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> p[i];
  int cnt = 0, ans = 0;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    cnt += x;
  }
  if (!(cnt & 1)) ans++;
  int cyc = 0;
  for (int i = 1; i <= n; i++)
    if (!mark[i]) {
      dfs(i);
      cyc++;
    }
  if (cyc > 1) ans += cyc;
  cout << ans << endl;
  return 0;
}
