import std.stdio;
import std.range;
import std.array;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.container;
import std.typecons;
import std.random;
import std.csv;
import std.regex;
import std.math;
import core.time;
import std.ascii;
import std.digest.sha;
import std.outbuffer;

void main()
{
	int n = readln.chomp.to!int;
	int[] a = readln.chomp.split.map!(to!int).array;
	int[] b = readln.chomp.split.map!(to!int).array;
	int[][] modsA = new int[][](30, n);
	int[][] modsB = new int[][](30, n);
	int m = 2;
	foreach (k; 0..30) {
		foreach (i; 0..n) {
			modsA[k][i] = a[i] % m;
			modsB[k][i] = b[i] % m;
		}
		std.algorithm.sort(modsB[k]);
		m <<= 1;
	}
	int[] atom = new int[](31);
	m = 1;
	foreach (k; 0..30) {
		// [k, m].writeln;
		// modsB[k].writeln;
		foreach (i; 0..n) {
			const int c = modsA[k][i];
			// [T - c, 2T - c)
			int t = m;
			auto arr = modsB[k].assumeSorted;
			// writeln("\t\t", arr, " (", c, ") ", arr.lowerBound(t - c), " <=> ", arr.lowerBound(2 * t - c));
			int left = cast(int)arr.lowerBound(t - c).length;
			int right = cast(int)arr.lowerBound(2 * t - c).length;
			int sub = right - left;
			sub = sub.max(0);
			// writeln("\t\t\tsub := ", sub);
			// [3T - c, 4T - c)
			// writeln("\t\t", arr, " (", c, ") ", arr.lowerBound(3 * t - c), " <=> ", arr.lowerBound(4 * t - c));
			int left2 = cast(int)arr.lowerBound(3 * t - c).length;
			int right2 = cast(int)arr.lowerBound(4 * t - c).length;
			int sub2 = right2 - left2;
			// writeln("\t\t\tsub2 := ", sub2);
			sub2 = sub2.max(0);
			atom[k] = (atom[k] + sub + sub2) % 2;
		}
		// writefln("...atom[%d] = %d", k, atom[k]);
		m <<= 1;
	}
	// atom.writeln;
	int ans = 0;
	foreach (i, v; atom) {
		ans |= v << i;
	}
	ans.writeln;
}