#include <bits/stdc++.h>
using namespace std;
int dig[31][200002];
int main() {
  int n;
  cin >> n;
  int a[200002], b[200002];
  long long ca[31], cb[31];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    int p = 1;
    for (int j = 0; j < 31; j++) {
      if (a[i] & p) ca[j]++;
      p *= 2;
    }
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    int p = 1;
    for (int j = 0; j < 31; j++) {
      if (b[i] & p) cb[j]++;
      dig[j][i] = b[i] % p;
      p *= 2;
    }
  }
  int p = 1;
  int ans = 0;
  for (int j = 0; j < 31; j++) {
    sort(dig[j], dig[j] + n);
    long long carry = ((ca[j] + cb[j]) * n - ca[j] * cb[j] * 2) % 2;
    for (int i = 0; i < n; i++) {
      carry = (carry + n -
               (lower_bound(dig[j], dig[j] + n, p - a[i] % p) - dig[j])) %
              2;
    }
    ans += carry * p;
    p *= 2;
  }
  cout << ans << endl;
}
