#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <valarray>
#include <utility>
#include <numeric>
#include <memory>
#include <functional>
#include <stdexcept>
#include <typeinfo>
#include <limits>
#include <complex>
#include <locale>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
using ui=unsigned;
using ll=long long;
using ull=unsigned long long;
using ld=long double;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using hash_type=ull;
using Complex=complex<double>;
using vi=vector<int>;
using vll=vector<ll>;
using vpii=vector<pii>;
using vpll=vector<pll>;
using si=set<int>;
using sstr=set<string>;
using sll=set<ll>;
using mii=map<int,int>;
using msi=map<string,int>;
using mis=map<int,string>;
using mll=map<ll,ll>;
using usi=unordered_set<int>;
using usstr=unordered_set<string>;
using usll=unordered_set<ll>;
using umii=unordered_map<int,int>;
using umsi=unordered_map<string,int>;
using umis=unordered_map<int,string>;
using umll=unordered_map<ll,ll>;
template<typename T>using min_queue=priority_queue<T,vector<T>,greater<T>>;
template<typename T>using max_queue=priority_queue<T>;
#define rep(i,n) for (int i=0;i<(n);i++)
#define Rep(i,a,b) for (int i=(a);i<=(b);i++)
#define repit(it,a) for (__typeof(a.begin()) it=a.begin();it!=a.end();++it)
#define eprintf(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define RET(p,x) return p<<x<<endl,0
#define all(a) (a).begin(),(a).end()
#define reunique(v) v.erase(unique(all(v)),v.end())
#define sz(a) (int)a.size()
#define fill_inf(a) memset(a,-19999873,sizeof(a))
#define fill_neginf(a) memset(a,-19999872,sizeof(a))
#define fill_0(a) memset(a,0,sizeof(a))
#define fill_neg1(a) memset(a,0,sizeof(a))
#define X first
#define Y second
#define __str__(x) #x
#define sqr(x) ((x)*(x))
#define Debug(x) cerr<<#x<<" = "<<x<<endl
#define Debug2(x,y) cerr<<#x<<" = "<<x<<", "<<#y<<" = "<<y<<endl
#define Debug3(x,y,z) cerr<<#x<<" = "<<x<<", "<<#y<<" = "<<y<<", "<<#z<<" = "<<z<<endl
const int inf=1e9;
const ll lnf=1e18;
const int mod=1e9+7;
const int mod2=1e9+9;
const int Maxn=2e5+5;
const int Maxp=28;
ll n,ans;
ll a[Maxn],b[Maxn],c[Maxn];
bool ok(ll u)
{
	rep(i,n) c[i]=b[i]%(1<<u+1);
	sort(c,c+n);
	ll res=0;
	rep(i,n)
	{
		ll itr=lower_bound(c,c+n,(1<<u)-a[i]%(1<<u+1))-c;
		res=(res+itr)%2;
		itr=lower_bound(c,c+n,(1<<u+1)-a[i]%(1<<u+1))-c;
		res=(res-itr%2+2)%2;
		itr=lower_bound(c,c+n,(3<<u)-a[i]%(1<<u+1))-c;
		res=(res+n-itr)%2;
	}
	return res;
}
int main()
{
	ios_base::sync_with_stdio(false);cin.tie();cout.tie();
	cout<<setprecision(15);
	cin>>n;
	rep(i,n) cin>>a[i];
	rep(i,n) cin>>b[i];
	rep(i,Maxp+1) if (ok(i)) ans|=1<<i;
	cout<<ans<<endl;
	cerr<<"\n\nTime elapsed : "<<(double)clock()*1.0/1000<<" seconds.\n";
	return 0;
}

Measured memory_bytes: 4992