#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5;
int vis[MAXN] = {0}, p[MAXN] = {0};
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> p[i];
    p[i]--;
  }
  int ones = 0;
  for (int i = 0; i < n; i++) {
    int num;
    cin >> num;
    if (num == 1) ones++;
  }
  int i = 0, v = 0, ans = 0;
  while (i < n) {
    vis[v] = 1;
    if (vis[p[v]]) {
      while (i < n && vis[i]) {
        i++;
      }
      if (i < n || p[v] != 0) {
        v = i, ans++;
      }
    } else {
      v = p[v];
    }
  }
  if (ones % 2 == 0) ans++;
  cout << ans << endl;
}
