#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) ((y)<0||(x)<0||(y)>=(h)||(x)>=(w))
#define dump(...)
const signed INF_=1001001001; const ll INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct{template<class T> operator T(){T x;cin>>x;return x;}} IN;
struct before_main_function {
    before_main_function() {
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int N;
    cin>>N;
    vector<int> A(N),B(N);
    cin>>A>>B;

    vector<vector<pii>> a(29),b(29);
    vector<vector<int>> cnt(29,vector<int>(N,0));
    REP(i,29) {
        REP(j,N) {
            a[i].push_back({A[j]&((1<<(i+1))-1),j});
            b[i].push_back({B[j]&((1<<(i+1))-1),j});
        }
        sort(ALL(b[i]));
        cnt[i][0]=(B[b[i][0].second]>>(i+1))&1;
        REPF(j,1,N) cnt[i][j]=cnt[i][j-1]+((B[b[i][j].second]>>(i+1))&1);
    }

    int ans=0;
    int a_one=0,a_zero,b_one=0,b_zero;
    REP(i,N) if(a[0][i].first) a_one++;
    REP(i,N) if(b[0][i].first) b_one++;
    a_zero=N-a_one,b_zero=N-b_one;
    ans=(a_zero*b_one)+(a_one*b_zero);
    ans%=2;
    REPF(i,1,29) {
        int c=0;
        REP(j,N) {
            int x=a[i][j].first&((1<<i)-1);
            int y=(1<<i)-x;
            int idx=distance(begin(b[i-1]),lower_bound(ALL(b[i-1]),pii(y,0)));
            int tmp=0;
            if((a[i][j].first>>i)&1) {
                // 繰り上がりあり: b -> 1
                tmp=cnt[i-1][N-1];
                if(idx>0) tmp-=cnt[i-1][idx-1];
                // 繰り上がりなし: b -> 0
                if(idx>0) tmp+=idx-cnt[i-1][idx-1];
            } else {
                // 繰り上がりあり: b -> 0
                tmp=cnt[i-1][N-1];
                if(idx>0) tmp-=cnt[i-1][idx-1];
                tmp=(N-idx)-tmp;
                // 繰り上がりなし: b -> 1
                if(idx>0) tmp+=cnt[i-1][idx-1];
            }
            c+=tmp;
        }
        if(c%2) ans|=1<<i;
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 240172