#include <bits/stdc++.h>
using namespace std;
int p[200005];
int b[200005];
int vis[200005];
void fun(int m) {
  vis[m] = 1;
  if (vis[p[m] - 1] == 0) {
    fun(p[m] - 1);
  }
}
int main() {
  int n;
  int sum = 0;
  int flag = 0;
  int ans = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    if (b[i] == 1) flag++;
  }
  if (flag % 2 == 0) sum++;
  for (int i = 0; i < n; i++) {
    if (vis[i] == 0) {
      ans++;
      fun(i);
    }
  }
  if (ans == 1) ans = 0;
  printf("%d", ans + sum);
  return 0;
}
