#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
#define MOD (1e9+7)
void get() {}template<class H, class...T>void get(H&h, T&...t) { cin >> h; get(t...); }
template<class T>void geti(T&a) { for (auto&_ : a)cin >> _; }
template<class T>void getii(T&a) { for (auto&_ : a)geti(_); }
void put(string d) {}template<class H, class...T>void put(string d, H&h, T&...t) { cout << h; if (sizeof...(t))cout << d; put(d, t...); }
template<class T>void puti(T&a, string d = " ") { bool f = 1; for (auto&_ : a)cout << (exchange(f, 0) ? "" : d) << _; cout << endl; }
template<class T>void putii(T&a, string d = " ") { for (auto&_ : a)puti(_, d); }
#define dcl(...) ll __VA_ARGS__;get(__VA_ARGS__)
#define dclt(t,...) t __VA_ARGS__;get(__VA_ARGS__)

constexpr int dpow[] = { 1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456, 536870912 };

bool cmp(const pii &l, const pii &r) {
    return l.fs < r.fs;
}

int main() {
    int N;
    cin >> N;
    vector<pii> va(N, pii{ 0,0 });
    vector<pii> vb(N, pii{ 0,0 });
    rep(i, N) {
        cin >> va[i].sc;
    }
    rep(i, N) {
        cin >> vb[i].sc;
    }
    int mx = (max(max_element(all(va))->sc, max_element(all(vb))->sc));
    if (mx < 2) {
        mx = 1;
    }
    else {
        mx = 1 + log2(mx);
    }
    //cout << mx << endl;
    int digit = 28;
    long long int ans = 0;
    unsigned long long int b = 0;

    rep(i, N) {

        va[i].fs += (va[i].sc&dpow[0]);

        vb[i].fs += (vb[i].sc&dpow[0]);
        b += ((va[i].sc&dpow[0]) + (vb[i].sc&dpow[0]));
    }
    b *= (N % 2 + 2);
    ans += (b % 2)*dpow[0];
    while (1) {

        if (mx == 1)break;

        b = 0;
        sort(all(vb));

        /*for (auto a : va) {
            cout << a.sc << "->" << a.fs << " ";
        }
        cout << endl;
        for (auto a : vb) {
            cout << a.sc << "->" << a.fs << " ";
        }
        cout << endl;*/

        for (auto a : va) {
            int tmp = lower_bound(all(vb), pii(dpow[29 - digit] - a.fs, 0), cmp) - vb.begin();
            //cout << dpow[29 - digit] - a.fs << " " << N - tmp << endl;
            b += (N - tmp);
        }

        //cout << "b--> " << b << endl;

        int c = 0;

        rep(i, N) {

            va[i].fs += (va[i].sc&dpow[29 - digit]);

            vb[i].fs += (vb[i].sc&dpow[29 - digit]);
            c += ((va[i].sc&dpow[29 - digit]) + (vb[i].sc&dpow[29 - digit]));
        }
        c >>= (29 - digit);
        c *= (N % 2 + 2);
        b += c;

        //cout << b << endl;

        ans += (b % 2)*dpow[29 - digit];
        digit--;
        if (digit == 28 - mx) {
            break;
        }
    }
    cout << ans;
}


Measured memory_bytes: 3328