n = gets.chomp.to_i
a_array = gets.chomp.split(" ").map(&:to_i)
b_array = gets.chomp.split(" ").map(&:to_i)


sum_array = []
a_array.each do |a| 
  b_array.each do |b| a + b 
    sum_array.push(a + b)
  end
end 

puts sum_array.reduce{ |xor, sum| xor ^ sum}
