#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> lst(200001);
bool visited[200001];
void dfs(int e) {
  visited[e] = true;
  for (int p = 0; p < lst[e].size(); p++) {
    if (!visited[lst[e][p]]) dfs(lst[e][p]);
  }
}
void makefalse() {
  for (int i = 0; i < 200001; i++) visited[i] = false;
}
int main() {
  int n;
  cin >> n;
  int one = 0;
  for (int i = 1; i < n + 1; i++) {
    int j;
    cin >> j;
    lst[i].push_back(j);
    lst[j].push_back(i);
  }
  for (int i = 0; i < n; i++) {
    int j;
    cin >> j;
    if (j == 1) one++;
  }
  int ans = 0;
  if (one % 2 == 0) ans++;
  int compo = 0;
  makefalse();
  for (int i = 1; i < n + 1; i++) {
    if (!visited[i]) {
      dfs(i);
      compo++;
    }
  }
  if (compo > 1) ans += compo;
  cout << ans;
}
