#include <bits/stdc++.h>
using namespace std;
vector<long long> q[2];
long long x[210000], y[210000];
long long bit[100];
int n;
long long solve() {
  long long ans = 0;
  for (long long i = 0; i < 62; i++) {
    long long tot = 0;
    q[0].clear();
    q[1].clear();
    for (long long j = 1; j <= n; j++) q[(x[j] >> i) & 1].push_back(x[j]);
    for (long long j = 0; j < q[0].size(); j++) x[++tot] = q[0][j];
    for (long long j = 0; j < q[1].size(); j++) x[++tot] = q[1][j];
    tot = 0;
    q[0].clear();
    q[1].clear();
    for (long long j = 1; j <= n; j++) q[(y[j] >> i) & 1].push_back(y[j]);
    for (long long j = 0; j < q[0].size(); j++) y[++tot] = q[0][j];
    for (long long j = 0; j < q[1].size(); j++) y[++tot] = q[1][j];
    long long len1 = 1, len2 = 1, len3 = 1;
    long long limit1 = 1ll << i;
    long long limit2 = 1ll << (i + 1);
    long long all = (1ll << (i + 1)) - 1;
    long long sum = 0;
    for (long long i = n; i >= 1; i--) {
      while ((((x[i] & all) + (y[len1] & all)) < limit1) && (len1 <= n)) len1++;
      while ((((x[i] & all) + (y[len2] & all)) < limit2) && (len2 <= n)) len2++;
      while (((x[i] & all) + (y[len3] & all) < limit1 + limit2) && (len3 <= n))
        len3++;
      sum += n - (len1 - 1 - len2 + 1 + len3 - 1);
    }
    if (sum & 1) ans += bit[i];
  }
  return ans;
}
int main() {
  int cas;
  cas = 1;
  bit[0] = 1;
  for (long long i = 1; i <= 61; i++) bit[i] = bit[i - 1] * 2;
  for (long long ca = 1; ca <= cas; ca++) {
    scanf("%lld", &n);
    for (long long i = 1; i <= n; i++) scanf("%lld", &x[i]);
    for (long long i = 1; i <= n; i++) scanf("%Illd", &y[i]);
    printf("%lld\n", solve());
  }
}
