print((function (f, n, s, t)
	return f(n, s, t)
end)(function (n, s, t)
	local a,b = {},{}
	for e in s:gmatch("%d+") do table.insert(a,tonumber(e)) end
	for e in t:gmatch("%d+") do table.insert(b,tonumber(e)) end
	if n == 1 then return a[1]+b[1] end

	local r,bxor = a[1]+b[1],bit.bxor
	for i=2,n do r = bxor(r,a[1]+b[i]) end
	for i=2,n do for j=1,n do r = bxor(r,a[i]+b[j]) end end
	return r
end, tonumber(io.stdin:read("*l")), io.stdin:read("*l"), io.stdin:read("*l")))