import macros, algorithm, tables, sets, lists, queues, intsets, critbits, sequtils, strutils, math, future, unicode

var
  n = stdin.readLine.parseInt
  a = stdin.readLine.split.map(parseInt)
  b = stdin.readLine.split.map(parseInt)
  temp_b = b
  k = 1
  ans = 0
  t = 0
  check = 0
  x = 0

for i in 1..30:
    t = k * 2
    #temp_b = sorted([x mod t for x in b])
    for j in 0..<b.len:
      temp_b[j] = b[j] mod t
    temp_b.sort(system.cmp[int])
    check = 0
    for temp_a in a:
        x = temp_a mod t
        #echo k, " ", temp_b, temp_b.lowerBound(k - x), " ",temp_b.lowerBound(4 * k - x)
        check += temp_b.lowerBound(2 * k - x) - temp_b.lowerBound(k - x) + temp_b.lowerBound(4 * k - x) - temp_b.lowerBound(3 * k - x)
    ans += k * (check mod 2)
    k = t

echo ans
