#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
void *wmem;
char memarr[96000000];
template<class T> inline void walloc1d(T **arr, int x, void **mem = &wmem){
  static int skip[16] = {0, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
  (*mem) = (void*)( ((char*)(*mem)) + skip[((unsigned long long)(*mem)) & 15] );
  (*arr)=(T*)(*mem);
  (*mem)=((*arr)+x);
}
template<class T1> void sortA_L(int N, T1 a[], void *mem = wmem){
  sort(a, a+N);
}
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
template<class T> long long counterSumIsLT(int As, T A[], int Bs, T B[], T val){
  int i = 0;
  int j = Bs;
  long long res = 0;
  while(i < As){
    while(j && A[i] + B[j-1] >= val){
      j--;
    }
    if(!j){
      break;
    }
    while(i<As && A[i] + B[j-1] < val){
      i++;
      res += j;
    }
  }
  return res;
}
int N;
int A[200000];
int B[200000];
int a0s;
int a0[200000];
int a1s;
int a1[200000];
int b0s;
int b0[200000];
int b1s;
int b1[200000];
int main(){
  int bt;
  wmem = memarr;
  int res = 0;
  int all;
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=(0);Lj4PdHRW<(N);Lj4PdHRW++){
      rd(A[Lj4PdHRW]);
    }
  }
  {
    int e98WHCEY;
    for(e98WHCEY=(0);e98WHCEY<(N);e98WHCEY++){
      rd(B[e98WHCEY]);
    }
  }
  for(bt=(30)-1;bt>=(0);bt--){
    int i;
    all = (1<<(bt+1)) - 1;
    a0s = a1s = b0s = b1s = 0;
    for(i=(0);i<(N);i++){
      if(((A[i]) &(1<<(bt)))){
        a1[a1s++] = (A[i]&all) ^(1<<(bt));
      }
      else{
        a0[a0s++] = (A[i]&all);
      }
      if(((B[i]) &(1<<(bt)))){
        b1[b1s++] = (B[i]&all) ^(1<<(bt));
      }
      else{
        b0[b0s++] = (B[i]&all);
      }
    }
    sortA_L(a0s, a0);
    sortA_L(a1s, a1);
    sortA_L(b0s, b0);
    sortA_L(b1s, b1);
    if(counterSumIsLT(a0s, a0, b1s, b1,(1<<(bt))) % 2){
      res ^=(1<<(bt));
    }
    if(counterSumIsLT(a1s, a1, b0s, b0,(1<<(bt))) % 2){
      res ^=(1<<(bt));
    }
    if(((long long) a0s * b0s - counterSumIsLT(a0s, a0, b0s, b0,(1<<(bt)))) % 2){
      res ^=(1<<(bt));
    }
    if(((long long) a1s * b1s - counterSumIsLT(a1s, a1, b1s, b1,(1<<(bt)))) % 2){
      res ^=(1<<(bt));
    }
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20191111-1

// --- original code ---
// int N, A[2d5], B[2d5];
// 
// int a0s, a0[2d5], a1s, a1[2d5];
// int b0s, b0[2d5], b1s, b1[2d5];
// 
// {
//   int res = 0, all;
//   rd(N,A(N),B(N));
//   rrep(bt,30){
//     all = (1<<(bt+1)) - 1;
//     a0s = a1s = b0s = b1s = 0;
//     rep(i,N){
//       if(BIT_ith(A[i],bt)) a1[a1s++] = (A[i]&all) ^ BIT_ith(bt);
//       else                 a0[a0s++] = (A[i]&all);
//       if(BIT_ith(B[i],bt)) b1[b1s++] = (B[i]&all) ^ BIT_ith(bt);
//       else                 b0[b0s++] = (B[i]&all);
//     }
//     sortA(a0s, a0); sortA(a1s, a1);
//     sortA(b0s, b0); sortA(b1s, b1);
//     if(counterSumIsLT(a0s, a0, b1s, b1, BIT_ith(bt)) % 2) res ^= BIT_ith(bt);
//     if(counterSumIsLT(a1s, a1, b0s, b0, BIT_ith(bt)) % 2) res ^= BIT_ith(bt);
//     if(((ll) a0s * b0s - counterSumIsLT(a0s, a0, b0s, b0, BIT_ith(bt))) % 2) res ^= BIT_ith(bt);
//     if(((ll) a1s * b1s - counterSumIsLT(a1s, a1, b1s, b1, BIT_ith(bt))) % 2) res ^= BIT_ith(bt);
//   }
//   wt(res);
// }


Measured memory_bytes: 6016