#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> p;
vector<bool> used;
int ans = 0;
inline void dfs(int v) {
  used[v] = 1;
  if (!used[p[v]]) {
    dfs(p[v]);
  }
}
int main() {
  cin >> n;
  p.resize(n);
  used.resize(n);
  for (int i = 0; i < n; ++i) {
    cin >> p[i];
    --p[i];
  }
  int s = 0, pr;
  for (int i = 0; i < n; ++i) {
    cin >> pr;
    s += pr;
  }
  if (s % 2 == 0) {
    ++ans;
  }
  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    if (!used[i]) {
      ++cnt;
      dfs(i);
    }
  }
  ans += (cnt == 1 ? 0 : cnt);
  cout << ans;
  return 0;
}
