#include <bits/stdc++.h>
#pragma GCC optimize("3", "inline", "Ofast")
using namespace std;
int qreadInt() {
  int x = 0, op = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') op = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') (x *= 10) += (ch - '0'), ch = getchar();
  return x * op;
}
void cmin(int &x, int y) { x = (x > y) ? y : x; }
int a[100010], b[100010];
int main() {
  int n = qreadInt(), now = 0, Ans = 1;
  for (int i = (1); i <= (n); ++i) a[i] = qreadInt(), now ^= a[i];
  for (int i = (1); i <= (n); ++i) {
    b[i] = qreadInt();
    if (now == b[i]) Ans--, now = -1;
    if (a[i] != b[i]) Ans++;
  }
  cout << Ans << endl;
  return 0;
}
