#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
/* #include <regex> */

using namespace std;

/* g++ -g -std=c++11 */

/* freopen("input.txt", "rt", stdin); */
/* freopen("output.txt", "wt", stdout); */

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

/* same problem hdu 5270 */

const int maxn = 2e5+5;
int n, A[maxn], B[maxn], C[maxn];

int first_y(const int a, const int x)
{
    int lo = 0, hi = n-1;
    while (lo < hi) {
        const int m = lo+(hi-lo)/2;
        if (a+C[m] >= x)
            hi = m;
        else
            lo = m+1;
    }
    if (!(a+C[lo] >= x))
        return -1;
    return lo;
}

int last_y(const int a, const int x)
{
    int lo = 0, hi = n-1;
    while (lo < hi) {
        const int m = lo+(hi-lo+1)/2;
        if (a+C[m] < x)
            lo = m;
        else
            hi = m-1;
    }
    if (!(a+C[hi] < x))
        return -1;
    return hi;
}

int main()
{
    ios::sync_with_stdio(false);
    while (cin >> n) {
        FOR(i,0,n)
            cin >> A[i];
        FOR(i,0,n)
            cin >> B[i];
        int ans = 0;
        FOR(i,0,30) {
            int T = 1<<i;
            FOR(j,0,n)
                C[j] = B[j]%(2*T);
            sort(C,C+n);
            LL cnt = 0;
            FOR(j,0,n) {
                const int a = A[j]%(2*T);
                const int i1 = first_y(a,T);
                const int j1 = last_y(a,2*T);
                if (i1 >= 0 && j1 >= 0 && i1 <= j1)
                    cnt += j1-i1+1;
                const int i2 = first_y(a,3*T);
                const int j2 = last_y(a,4*T);
                if (i2 >= 0 && j2 >= 0 && i2 <= j2)
                    cnt += j2-i2+1;
            }
            if (cnt&1)
                ans += 1<<i;
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 2560