#include <bits/stdc++.h>
using namespace std;
int p[1000002], b[1000002], odw[1000002];
void dfs(int n) {
  odw[n] = 1;
  if (odw[p[n]] == 0) dfs(p[n]);
}
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> p[i];
  }
  int s = 0, wyn = 0, pom = 0;
  for (int i = 0; i < n; i++) {
    int b;
    cin >> b;
    s += b;
  }
  if (s % 2 == 0) pom = 1;
  for (int i = 1; i <= n; i++) {
    if (odw[i] == 0) {
      wyn++;
      dfs(i);
    }
  }
  if (wyn == 1) wyn = 0;
  cout << wyn + pom;
}
