#include <bits/stdc++.h>
using namespace std;
int n;
const int MAXN = 2e5;
int to[MAXN];
bool used[MAXN];
int main() {
  scanf("%d", &n);
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &to[i]);
    --to[i];
  }
  for (int i = 0; i < n; ++i) {
    if (!used[i]) {
      ++ans;
      int u = i;
      while (!used[u]) {
        used[u] = 1;
        u = to[u];
      }
    }
  }
  if (ans == 1) {
    --ans;
  }
  bool fl0 = 1;
  bool fl1 = 1;
  int ctr1 = 0;
  int p;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &p);
    if (!p) {
      fl0 = 0;
    } else {
      ++ctr1;
      fl1 = 0;
    }
  }
  if (ctr1 % 2 == 0) {
    ++ans;
  }
  cout << ans;
}
