// Reads multiple ints in a line, separate by a space.
// It works even if the actual number of ints is smaller than n.
// WARNING: This function does not work for -2^31.
// NOTE: This function does not handle error cases.
fun fastReadInts(n: Int): IntArray {
  val xs = IntArray(n)
  val s = readLine()!!
  var currentValue = 0
  var isNegative = false
  var currentIndex = 0
  for (c in s) {
    if (c == ' ') {
      xs[currentIndex] = currentValue * if (isNegative) -1 else 1
      currentValue = 0
      isNegative = false
      currentIndex++
    } else if (c == '-') {
      isNegative = true
    } else {
      currentValue *= 10
      currentValue += c - '0'
    }
  }
  xs[currentIndex] = currentValue * if (isNegative) -1 else 1
  return xs
}

fun countAtMost(xs: IntArray, z: Int): Int {
  if (xs[0] > z) return 0
  // Find largest m s.t. xs[m] <= z
  var l = 0
  var u = xs.size - 1
  while (l < u) {
    val m = (l + u + 1) / 2
    if (xs[m] <= z) {
      l = m

    } else {
      u = m - 1
    }
  }
  return l + 1
}

fun main(args: Array<String>) {
  val n = readLine()!!.toInt()
  val xs = fastReadInts(n)
  val ys = fastReadInts(n)
//  val n = 200000
//  val xs = IntArray(n, { (Math.random() * 1000000).toInt() })
//  val ys = IntArray(n, { (Math.random() * 1000000).toInt() })
  // println("HELLO")
  // mods[i]: List of xs mod (1 << (i + 1))
  val mods = Array(30, { IntArray(n) })
  for (b in 0 until 30) {
    for (i in 0 until n) {
      mods[b][i] = xs[i] % (1 shl (b + 1))
    }
    mods[b].sort()
  }

  val modCounts = Array(15, { IntArray(1 shl (it + 1)) })
  val modSums = Array(15, { IntArray(1 shl (it + 1)) })
  for (b in 0 until 15) {
    for (i in 0 until n) {
      modCounts[b][mods[b][i]]++
    }
    modSums[b][0] = modCounts[b][0]
    for (i in 1 until (1 shl (b + 1))) {
      modSums[b][i] = modSums[b][i - 1] + modCounts[b][i]
    }
  }

  fun countAtMost2(b: Int, u: Int): Int {
    if (u < 0) return 0
    return modSums[b][u]
  }

  // println("HOGEHOGE")
  var ans = 0
  for (y in ys) {
    for (b in 0 until 30) {
      val dy = y % (1 shl (b + 1))
      var count = 0
      if (b < 15) {
        if (dy <= 1 shl b) {
          count +=countAtMost2(b, (1 shl (b + 1)) - dy - 1) -
              countAtMost2(b, (1 shl b) - dy - 1)
//        println("HOGE1: " + countAtMost(mods[b], (1 shl (b + 1)) - dy - 1))
//        println("HOGE2: " + countAtMost(mods[b], (1 shl b) - dy - 1))
        } else {
          count += countAtMost2(b, (1 shl (b + 1)) - dy - 1) +
              n -
              countAtMost2(b,(1 shl b) - dy + (1 shl (b + 1)) - 1)
        }
      } else {
        // m + dy in [2 ^ b, 2 ^ (b + 1))
        // i.e.
        // If dy <= 2 ^ b: m in [2 ^ b - dy, 2 ^ (b + 1) - dy)
        // If not: [0, 2 ^ (b + 1) - dy), [2 ^ b - dy + 2 ^ (b + 1), 2^ (b + 1))
        if (dy <= 1 shl b) {
          count += countAtMost(mods[b], (1 shl (b + 1)) - dy - 1) -
              countAtMost(mods[b], (1 shl b) - dy - 1)
//        println("HOGE1: " + countAtMost(mods[b], (1 shl (b + 1)) - dy - 1))
//        println("HOGE2: " + countAtMost(mods[b], (1 shl b) - dy - 1))
        } else {
          count += countAtMost(mods[b], (1 shl (b + 1)) - dy - 1) +
              n -
              countAtMost(mods[b], (1 shl b) - dy + (1 shl (b + 1)) - 1)
        }
      }

      if (count % 2 == 1) {
        // println("$y $b")
        ans = ans xor (1 shl b)
      }
    }
  }
  println(ans)
}


Measured memory_bytes: 90384