#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > Adj;
vector<int> mark;
void init(int n) {
  mark.assign(n, 0);
  Adj.resize(n);
}
void dfs(int u) {
  mark[u] = 1;
  for (int v : Adj[u]) {
    if (!mark[v]) dfs(v);
  }
}
int main() {
  int rpta = 0;
  int n;
  cin >> n;
  init(n);
  for (int i = 0; i < n; ++i) {
    int l;
    cin >> l;
    --l;
    Adj[i].push_back(l);
    Adj[l].push_back(i);
  }
  for (int i = 0; i < n; ++i) {
    int l;
    cin >> l;
    rpta = (rpta + l) % 2;
  }
  rpta = (rpta + 1) % 2;
  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    if (!mark[i]) {
      dfs(i);
      ++cnt;
    }
  }
  if (cnt > 1) {
    rpta += cnt;
  }
  cout << rpta << "\n";
  return 0;
}
