import std.algorithm;
import std.array;
import std.conv;
import std.range;
import std.stdio;
import std.string;


int naiveSolver(int[] xs, int[] ys) {
	int res = 0;
	foreach (x, y; cartesianProduct(xs, ys)) {
		res ^= (x + y);
	}
	return res;
}


void main() {
	auto n = readln.chomp.to!int;
	auto xs = readln.split.map!(to!int).array;
	auto ys = readln.split.map!(to!int).array;
	auto res = naiveSolver(xs, ys);
	writeln(res);
}
