#include <bits/stdc++.h>
using namespace std;
int vv[1000000];
bool mark[1000000];
void dfs(int v) {
  mark[v] = true;
  if (mark[vv[v]]) return;
  dfs(vv[v]);
  return;
}
int main() {
  int n;
  cin >> n;
  int answer = 0;
  for (int i = 1; i <= n; i++) {
    cin >> vv[i];
  }
  int num = 0;
  for (int i = 0; i < n; i++) {
    int w;
    cin >> w;
    num += w;
  }
  if (num % 2 == 0) answer++;
  num = 0;
  for (int i = 1; i <= n; i++) {
    if (!mark[i]) {
      num++;
      dfs(i);
    }
  }
  if (num > 1) {
    cout << answer + num << endl;
    return 0;
  }
  cout << answer << endl;
  return 0;
}
