#include <bits/stdc++.h> 
using namespace std;

#define sz(x) (int)x.size() 
#define pb push_back 
#define mp make_pair 
#define fi(a, b) for(int i=a; i<=b; i++) 
#define fj(a, b) for(int j=a; j<=b; j++) 
#define fo(a, b) for(int o=a; o<=b; o++) 
#define fdi(a, b) for(int i=a; i>=b; i--) 
#define fdj(a, b) for(int j=a; j>=b; j--) 
#define fdo(a, b) for(int o=a; o>=b; o--) 

#ifdef LOCAL
#define err(...) fprintf(stderr, __VA_ARGS__)
#else
#define err(...) while(false) {}
#endif

typedef long long ll; 
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef vector<int> vi; 
typedef vector<pii> vpii; 
typedef vector<pll> vpll; 
typedef long double ld;

template<class T> bool uin(T &a, T b){ return (a > b ? a = b, true : false); }
template<class T> bool uax(T &a, T b){ return (a < b ? a = b, true : false); }

/////////////////////////////////

int const MAXN = 2e5 + 41;
int const INF = 1e9 + 41;
int const MAXB = 30;
int const MAGIC = 12;

int n;
int a[MAXN], b[MAXN];
int vb[MAXB][MAXN];
int q[MAXB];

inline int getmask(int x, int b) {
	int res = (1 << b) - 1;
	return (res & x);
}

inline bool bit(int m, int i) {
	return (m & (1 << i));
}

inline int getgreq(int a[MAXN], int x) {
	int l = -1;
	int r = n;
	while(r - l > 1) {
		int m = (l + r) / 2;
		if (a[m] >= x) {
			r = m;
		} else {
			l = m;
		}
	}
	return n - r;
}

inline int getq(int a[MAXN], int x, int y) {
	if (x > y) {
		return 0;
	}
	int res = 0;
	res += getgreq(a, x);
	res -= getgreq(a, y + 1);
	return res;
}

int qa[MAXN], qb[MAXN], qq[MAXN];

void solvesmall() {
	fi(1, n) {		
		int ma = getmask(a[i], MAGIC);
		qa[ma] ^= 1;
		int mb = getmask(b[i], MAGIC);
		qb[mb] ^= 1;
	}	
	int k = (1 << MAGIC) - 1;
	fi(0, k) {
		if (!qa[i]) continue;
		fj(0, k) {
			if (!qb[j]) continue;
			qq[i + j] ^= 1;
		}
	}
	fi(0, MAXN - 1) {
		if (!qq[i]) continue;
		fj(0, MAGIC - 1) {
			int cur = bit(i, j);
			q[j] ^= cur;	
		}		
	}
}

void solve() {
	solvesmall();
	fi(1, n) {
		int cur = 0;
		fj(0, MAXB - 1) {
			if (bit(b[i], j)) {
				cur ^= (1 << j);
			}
			vb[j][i - 1] = cur;
		}
	}	
	fi(0, MAXB - 1) {
		sort(vb[i], vb[i] + n);
	}
	fi(1, n) {
		fj(MAGIC, MAXB - 1) {
			int ma = getmask(a[i], j);
			if (bit(a[i], j)) {
				//1
				int l = 0;
				int r = (1 << j) - ma - 1;
				q[j] += getq(vb[j], l, r);	
				//2
				if (j == 0) continue;
				l = (1 << j) - ma + (1 << j);
				r = INF;
				q[j] += getq(vb[j], l, r);
				if (q[j] & 1) {
					q[j] = 1;
				} else {
					q[j] = 0;
				}
			} else {
				//1
				int l = (1 << j) - ma;
				int r = (1 << j) - 1;
				q[j] += getq(vb[j], l, r);
				//2
				l = (1 << j);
				r = (1 << j) - ma + (1 << j) - 1;
				q[j] += getq(vb[j], l, r);
				if (q[j] & 1) {
					q[j] = 1;
				} else {
					q[j] = 0;
				}
			}
		}
	}
	int ans = 0;
	fi(0, MAXB - 1) {
		if (q[i] % 2 == 1) {
			ans ^= (1 << i);
		}
	}
	printf("%d\n", ans);
}

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	scanf("%d", &n);
	fi(1, n) {
		scanf("%d", &a[i]);
	}
	fi(1, n) {
		scanf("%d", &b[i]);
	}
	solve();

	/*srand(time(0) + clock());
	n = 200 * 1000;
	fi(1, n) {
		a[i] = i;
	}
	fi(1, n) {
		b[i] = i;
	}
	solve();
	*/


	
#ifdef LOCAL
	err("ELAPSED TIME: %.3Lf\n", (ld) clock() / CLOCKS_PER_SEC);
#endif	
	
	return 0;
}

Measured memory_bytes: 25600