#include <bits/stdc++.h>
#define F first
#define S second
#define dq deque
#define vc vector
#define INF (0x3f3f3f3f)
#define LINF ((long long)(0x3f3f3f3f3f3f3f3f))
#define Pb push_back
#define Mp make_pair
#define ll long long
#define _tp template
#define _tyn typename
#define Pf push_front
#define itor iterator
#define sint short int
#define ull unsigned ll
#define pii pair<int,int>
#define uint unsigned int
#define All(x) x.begin(),x.end()
#define B cout << "BreakPoint" << endl;
#define Ms(_data) memset(_data,0,sizeof(_data))
#define Fin(_filename) freopen(_filename,"r",stdin)
#define Fout(_filename) freopen(_filename,"w",stdout)
#define Msn(_data,_num) memset(_data,_num,sizeof(_data))
#define Fastio ios_base::sync_with_stdio(false);cin.tie(0);
#define O_(x) cout << #x << " " << x << "  ";
#define O(x) cout << #x << " " << x << endl;
using namespace std;
#define Mymax(a,b) if(a<b) a = b;
#define Mymin(a,b) if(a>b) a = b;
void Print(int _x){printf("%d\n",_x);}
void Print(ll _x){printf("%lld\n",_x);}
_tp<_tyn T>void Print( T _a[] , int _s , int _t ){
    for( int i = _s ; i <= _t ; i++ )
        cout << _a[i] << " ";
   	cout << endl;
}
#define il inline
#define rg register
struct InputReader{
	static const int bs = 100000;
    char buf[bs];
    int p;
    il InputReader():p(bs) {}
    il void Flush(){
        p = 0;
        fread(buf, 1, bs, stdin);
    }
    il char C(){
        if(p >= bs) Flush();
        return buf[p++];
    }
    int Getnum(){
        char ch = C();
        while( ch < '0'  ||  ch > '9' ) ch = C();
        return (int)(ch-'0');
    }
    il int operator() (){
        int ans = 0;
        char ch = C();
        int fu = 1;
        while( ch < '0'  ||  ch > '9' ){
            if( ch == '-' ) fu = -1;
            ch = C();
        }
        while( ch >= '0'  &&  ch <= '9' ){
            ans *= 10;
            ans += ch-'0';
            ch = C();
        }
        return ans * fu;
    }
    ll Readll(){
        ll ans = 0LL;
        ll fu = 1;
        char ch = C();
        while( ch < '0'  ||  ch > '9' ){
            if( ch == '-' ) fu = -1;
            ch = C();
        }
        while( ch >= '0'  &&  ch <= '9' ){
            ans *= 10LL;
            ans += ch-'0';
            ch = C();
        }
        return ans * fu;
    }
    il void Readstring( string &x ){
        x.clear();
        char ch = C();
        while( !isdigit(ch)  &&  !isalpha(ch) ) ch = C();
        while( isdigit(ch)  ||  isalpha(ch) ){
            x += ch;
            ch = C();
        }
        //x += '\0';
    }
    il void Readalpha( char &c ){
        c = C();
        while( !isalpha(c) ) c = C();
    }
    il char Specialread(){
        char ch = C();
        while( !isalpha(ch) ) ch = C();
        return ch;
    }
}In;
il void Read( int &x ){ x = In(); }
il void Read( int &x, int &y ){ x = In(); y = In(); }
il void Read( int &x1 , int &x2 , int &x3 ){
    x1 = In(); x2 = In(); x3 = In();
}
il void Read( int &x1 , int &x2 , int &x3 , int &x4 ){
    x1 = In(); x2 = In(); x3 = In(); x4 = In();
}
il void Read( ll &x ){
    x = In.Readll();
}
il void Read( ll &x, ll &y ){ x = In.Readll(); y = In.Readll(); }
il void Read( ll &x1 , ll &x2 , ll &x3 ){
    x1 = In.Readll(); x2 = In.Readll(); x3 = In.Readll();
}
il void Read( ll &x1 , ll &x2 , ll &x3 , ll &x4 ){
    x1 = In.Readll(); x2 = In.Readll(); x3 = In.Readll(); x4 = In.Readll();
}
clock_t _starttime , _endtime;
il void FILEIO(){
    #ifdef WIN32
        _starttime = clock();
        Fin("in.in");
    #endif
}
#ifdef WIN32
    #include <windows.h>
    #include <psapi.h>
#endif
il void END(){
    #ifdef WIN32
        _endtime = clock();
        double _timeuse = (_endtime-_starttime)* 1000.0 / CLOCKS_PER_SEC;
        printf("\n\nTime usage:\n%.0lf ms\n",_timeuse);
        HANDLE _handle = GetCurrentProcess();
        PROCESS_MEMORY_COUNTERS pmc;
        GetProcessMemoryInfo(_handle,&pmc,sizeof(pmc));
        double _memuse = pmc.PeakPagefileUsage/1024.00/1024.00;
        printf("Memory usage:\n%.1lf MB\n\n",_memuse);
    #endif
    exit(0);
}
#define For(i,j) for( rg int (i) = 1 ; (i) <= (j) ; (i)++ )
#define For0(i,j) for( rg int (i) = 0 ; (i) < (j) ; (i)++ )
#define Forx(i,j,k) for( rg int (i) = (j) ; (i) <= (k) ; (i)++ )
#define Forstep(i,j,k,st) for( rg int (i) = (j) ; (i) <= (k) ; (i) += (st) )
#define fOR(i,j) for( rg int (i) = (j) ; (i) >= 1 ; (i)-- )
#define fOR0(i,j) for( rg int (i) = (j)-1 ; (i) >= 0 ; (i)-- )
#define fORx(i,j,k) for( rg int (i) = (k) ; (i) >= (j) ; (i)-- )
int dx[] = {0,-1,0,1};
int dy[] = {1,0,-1,0};
//			D L U  R
#define Mymod(a,b) if( a >= b ) a -= b;
#define Rmod(a,b) a = (a%b+b)%b
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
#define MAXN 200010
#define MAXBIT 40
#define Pow2(x) (1<<x)
#define Lb(x) (lower_bound(b+1,b+1+n,x)-b)
#define Ub(x) (upper_bound(b+1,b+1+n,x)-b)
int Log2( int x ){
	int ret = 0;
	while(x){
		x >>= 1;
		ret++;
	}
	return ret;
}

int n;
int a[MAXN],inpb[MAXN],b[MAXN];
int mx = 0;
int mxlen = 0;

// 在b中有多少元素x满足 x+k < low
// OOOOOXXXXX
int Binsearchlow( int low , int k ){
	if( b[n]+k < low ) return n;
	if( b[1]+k >= low ) return 0;
	int l = 1 , r = n , mid , ret = 1;
	while( l < r ){
		mid = l+r >> 1;
		mid++;
		Mymin(mid,n);
		if( b[mid]+k < low ){
			l = mid;
			ret = mid;
		}else r = mid-1;
	}
	return l;
}
// 在b中有多少元素x满足 upp <= x+k
// XXXXXOOOOO
int Binsearchupp( int upp , int k ){
	if( upp <= b[1]+k ) return n;
	if( b[n]+k < upp ) return 0;
	int l = 1 , r = n , mid , ret = n;
	while( l < r ){
		mid = l+r >> 1;
		if( upp <= b[mid]+k ){
			r = mid;
			ret = mid;
		}else l = mid+1;
	}
	return n-l+1;
}
// 数一数b中多少个元素x满足 low <= x+k < upp
int Count( int low , int upp , int k ){
	int lowcnt = Binsearchlow(low,k);
	int uppcnt = Binsearchupp(upp,k);
	int ans = n - lowcnt - uppcnt;
	Mymax(ans,0);
	return ans;
}
int Count( int low , int upp , int mod , int k ){
	k %= mod;
	int ans = 0;
	For(i,n)
		if( low <= b[i]+k  &&  b[i]+k < upp )
			ans++;
	return ans;
}

int ans = 0;
int bitcnt[MAXBIT];

int main(){
	FILEIO();
	Ms(bitcnt);

	Read(n);
	For(i,n){
		Read(a[i]);
		Mymax(mx,a[i]);
	}
	For(i,n){
		Read(inpb[i]);
		Mymax(mx,inpb[i]);
	}
	mxlen = Log2(mx);

	For0(j,mxlen+1){
		int T = Pow2(j);
		For(k,n)
			b[k] = inpb[k] % (2*T);
		sort(b+1,b+1+n);

		For(i,n){
			int cnt1 = Count(T,2*T,a[i]%(2*T));
			int cnt2 = Count(3*T,4*T,a[i]%(2*T));
			/*
			#ifdef InterestingLSY
				int cnt3 = Count(T,2*T,2*T,a[i]%(2*T));
				int cnt4 = Count(3*T,4*T,2*T,a[i]%(2*T));
				if( cnt1 != cnt3 ){
					cout << "ERR!Cnt1 != Cnt3!" << endl;
					cout << "b  "; Print(b,1,n);
					cout << "k  " << a[i]%(2*T) << endl;
					cout << cnt1 << " " << cnt3 << endl;
					cout << T << " " << 2*T << endl;
					cout << endl;
					END();
				}
			#endif
			*/
			bitcnt[j] += cnt1+cnt2;
		}
	}

	For0(j,mxlen+1){
		if(bitcnt[j]&1)
			ans += Pow2(j);
	}
	printf("%d\n",ans);

	END();
}


Measured memory_bytes: 2688