local mfl, mmi = math.floor, math.min

local n = io.read("*n")
local a, b = {}, {}
local av, bv = {}, {}
for i = 1, n do
  a[i] = io.read("*n")
  av[i] = 0
end
for i = 1, n do
  b[i] = io.read("*n")
  bv[i] = 0
end
local mul = 1
local ret = 0
for _stage = 1, 30 do
  local a0, a1, a0v, a1v = {}, {}, {}, {}
  local b0, b1, b0v, b1v = {}, {}, {}, {}
  for i = 1, n do
    if a[i] % 2 == 0 then
      table.insert(a0, mfl(a[i] / 2))
      table.insert(a0v, av[i])
    else
      table.insert(a1, mfl(a[i] / 2))
      table.insert(a1v, av[i] + mul)
    end
    if b[i] % 2 == 0 then
      table.insert(b0, mfl(b[i] / 2))
      table.insert(b0v, bv[i])
    else
      table.insert(b1, mfl(b[i] / 2))
      table.insert(b1v, bv[i] + mul)
    end
  end
  for i = 1, #a0 do a[i], av[i] = a0[i], a0v[i] end
  for i = 1, #a1 do a[i + #a0], av[i + #a0] = a1[i], a1v[i] end
  for i = 1, #b0 do b[i], bv[i] = b0[i], b0v[i] end
  for i = 1, #b1 do b[i + #b0], bv[i + #b0] = b1[i], b1v[i] end

  local bp1, bp2, bp3 = n + 1, n + 1, n + 1
  local c1, c2, c3 = 0, 0, 0
  for i = 1, n do
    local iav = av[i]
    local bp3lim = mmi(n, bp3)
    for ib = bp3lim, 1, -1 do
      if mul * 3 <= bv[ib] + iav then
        bp3 = ib
      else break end
    end
    local bp2lim = mmi(n, mmi(bp2, bp3))
    for ib = bp2lim, 1, -1 do
      if mul * 2 <= bv[ib] + iav then
        bp2 = ib
      else break end
    end
    local bp1lim = mmi(n, mmi(bp1, bp2))
    for ib = bp1lim, 1, -1 do
      if mul <= bv[ib] + iav then
        bp1 = ib
      else break end
    end
    c3 = c3 + n + 1 - bp3
    c2 = c2 + n + 1 - bp2
    c1 = c1 + n + 1 - bp1
  end
  if (c1 - c2 + c3) % 2 == 1 then
    ret = ret + mul
  end
  mul = mul * 2
end
print(ret)
