//By TheOneYouWant

#pragma GCC optimize ("-O2")
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define memreset(a) memset(a,0,sizeof(a))
#define testcase(t) int t;cin>>t;while(t--)
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i = 0; i < e;++i)
#define forsn(i,s,e) for(int i = s; i < e;++i)
#define rforn(i,s) for(int i = s; i >= 0;--i)
#define rforsn(i,s,e) for(int i = s; i >= e;--i)
#define bitcount(a) __builtin_popcount(a) // set bits (add ll)
#define ln '\n'
#define getcurrtime ((double)clock()/CLOCKS_PER_SEC)
#define dbgarr(v,s,e) cerr<<#v<<" = "; forsn(i,s,e) cerr<<v[i]<<", "; cerr<<endl
#define inputfile freopen("input.txt", "r", stdin)
#define outputfile freopen("output.txt", "w", stdout)
#define dbg(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) { cerr<<endl; }
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << "\t"; err(++it, args...);
}
template<typename T1,typename T2>
ostream& operator <<(ostream& c,pair<T1,T2> &v){
    c<<"("<<v.fi<<","<<v.se<<")"; return c;
}
template <template <class...> class TT, class ...T>
ostream& operator<<(ostream& out,TT<T...>& c){
    out<<"{ ";
    forstl(x,c) out<<x<<" ";
    out<<"}"; return out;
}

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<int> v32; 
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<p64> vp64;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;

const int LIM=1e5+5, MOD=1e9+7;
const ld EPS = 1e-9;
// int t,n,m,k,x,y,w;
signed main(){
    fastio;
    
    int n;
    cin>>n;
    int a[n];
    int b[n];
    forn(i,n){
        cin>>a[i];
    }
    forn(i,n){
        cin>>b[i];
    }
    ll conva[n][30], convb[n][30];

    forn(i,n){
        forn(j,30){
            conva[i][j] = a[i]%2;
            a[i] /= 2;
            convb[i][j] = b[i]%2;
            b[i] /= 2;
        }
    }

    ll curr_a[n], curr_b[n];
    ll ans[30] = {0};
    ll finalans = 0;

    forn(i,30){
        v32 a_arr,b_arr;
        forn(j,n){
            if(i==0){
                curr_a[j] = conva[j][0];
                curr_b[j] = convb[j][0];
            }
            else{
                curr_a[j] += (1LL<<i)*conva[j][i];
                curr_b[j] += (1LL<<i)*convb[j][i];
            }
            a_arr.pb(curr_a[j]);
            b_arr.pb(curr_b[j]);
        }
        sort(a_arr.begin(),a_arr.end());
        sort(b_arr.begin(),b_arr.end());
        ll cnt = 0;
        forstl(r,a_arr){
            auto it = lower_bound(b_arr.begin(),b_arr.end(),(1LL<<i)-r);
            auto it2 = lower_bound(b_arr.begin(),b_arr.end(),(2*(1LL<<i))-r);
            cnt += it2-it;
            it = lower_bound(b_arr.begin(),b_arr.end(),(3*(1LL<<i))-r);
            it2 = lower_bound(b_arr.begin(),b_arr.end(),(4*(1LL<<i))-r);
            cnt += it2-it;
            // cout<<i<<" "<<r<<" "<<cnt<<ln;
            cnt %= 2;
        }
        // cout<<i<<" for this i "<<cnt<<ln;
        ans[i] = cnt%2;
    }
    rforn(i,29){
        finalans *= 2;
        finalans += ans[i];
        // cout<<i<<" "<<ans[i]<<ln;
    }



    cout<<finalans<<ln;

    return 0;
}

Measured memory_bytes: 103668