// 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
}

// Returns a number of elements less than a specified value.
// The input array needs be sorted.
fun countLessThan(xs: IntArray, v: Int): Int {
  var l  = 0
  var u = xs.size - 1
  while (l <= u) {
    val m = (l + u + 1) / 2
    if (xs[m] < v) {
      l = m + 1
    } else {
      u = m - 1
    }
  }
  return l
}

fun main(args: Array<String>) {
  val n = readLine()!!.toInt()
  val xs = fastReadInts(n)
  val ys = fastReadInts(n)

  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()
  }

  var ans = 0
  for (b in 0 until 30) {
    for (y in ys) {
      val dy = y % (1 shl (b + 1))
      var count = 0
      // 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 += countLessThan(mods[b], (1 shl (b + 1)) - dy) -
            countLessThan(mods[b], (1 shl b) - dy)
      } else {
        count += countLessThan(mods[b], (1 shl (b + 1)) - dy) +
            n -
            countLessThan(mods[b], (1 shl b) - dy + (1 shl (b + 1)))
      }

      if (count % 2 == 1) {
        ans = ans xor (1 shl b)
      }
    }
  }
  println(ans)
}
