#include <bits/stdc++.h>
using namespace std;
bool vis[200001];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i = 0; i < n; i++) cin >> p[i];
  vector<int> b(n);
  int ans = 1;
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    ans = (ans + b[i]) % 2;
  }
  int kilk = 0;
  for (int i = 0; i < n; i++)
    if (!vis[i]) {
      int pos = i;
      while (!vis[pos]) {
        vis[pos] = 1;
        pos = p[pos] - 1;
      }
      kilk++;
    }
  if (kilk == 1)
    cout << ans;
  else
    cout << ans + kilk;
}
