#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; }

/*
 * Given 2 array A[n],B[n], for all n*n number of ai+bj, compute the
 * XOR. eg. (a1+b1) XOR (a1+b2) XOR (a2+b1) XOR (a2+b2), .. etc.
 */
/*
 * Editorial:
 *
 * Since we can handle each bit independently, let's consider only the
 * k-th bit. We want to count the number of pairs (i,j) such that the
 * k-th bit of ai+bj is one. Let T=2^k. An important observation is
 * that, we are only interested in the values of ai,bi in modulo 2T.
 * Thus, let's replace ai with ai%(2T) and bi with bi%(2T), and assume
 * that ai,bi < 2T. Then, there are two cases when the k-th bit of
 * ai+bj is one:
 *
 * 1T <= ai+bj < 2T
 * 3T <= ai+bj < 4T
 *
 *     k-th bit         We are only interested in ai,bj, which has any
 *      |               bits from [0,k], hence ai%(2T), bj%(2T).
 * |--|--|--|--|
 * |. |1T|2T|4T|        If k-th bit is 1 for ai+bj, it can be
 * |--|--|--|--|        either:
 *
 * 1. k-th bit is 1, any bit between [0,k) can be either 0 or 1
 *    this results 1T <= ai+bj < 2T
 *
 * 2. k-th and k+1-th bits are both 1 (because addition can result a
 *    carrying into k+1-th bit).
 *    this results 3T <= ai+bj < 4T
 *
 * => taking ai%(2T), bj%(2T), and sort B[j] to make a continuous region
 * => that can satisfy the condition for each ai.
 *
 * Let's sort b in an increasing order. For a fixed i, the set of j that
 * satisfies T <= ai+bj < 2T forms an interval. Thus, we can count the
 * number of such js by binary search (or two-pointers). Similarly, we
 * can handle the second case.
 *
 * This solution works in O(N*logN*logMAX) time, where MAX is the
 * maximum number that can appear in the input.
 */
/* same problem hdu 5270 */

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

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) {
            const 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 = lower_bound(C,C+n,T-a) - &C[0];
                const int j1 = upper_bound(C,C+n,2*T-a-1) - &C[0];
                if (i1 < j1)
                    cnt += j1-i1;
                const int i2 = lower_bound(C,C+n,3*T-a) - &C[0];
                const int j2 = upper_bound(C,C+n,4*T-a-1) - &C[0];
                if (i2 < j2)
                    cnt += j2-i2;
            }
            if (cnt&1)
                ans += 1<<i;
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 2560