N = gets.chomp.to_i
alist = gets.chomp.split(" ").map(&:to_i)
blist = gets.chomp.split(" ").map(&:to_i)

result = 0
for i in 0...N
  for j in 0...N
    result ^= (alist[i] + blist[j])
  end
end
puts result