#include <bits/stdc++.h>
using namespace std;
long long p[200050], b[200050];
long long vi[200050];
void dfs(int a) {
  if (vi[a]) return;
  vi[a] = 1;
  dfs(p[a]);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> p[i + 1];
  }
  long long comp = 0;
  for (int i = 1; i <= n; i++) {
    if (!vi[i]) {
      comp++;
      dfs(i);
    }
  }
  long long fl = 0;
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    fl += b[i];
  }
  if (fl % 2 == 0)
    fl = 1;
  else
    fl = 0;
  long long ans = comp;
  if (comp == 1) ans = 0;
  ans += fl;
  cout << ans;
  return 0;
}
