fun readIntArray(n: Int): IntArray {
    val arr = IntArray(n)
    var i = 0
    var tmp = 0

    for (c in readLine()!!) {
        if (c == ' ') {
            arr[i] = tmp
            i++
            tmp = 0
        } else {
            tmp *= 10
            tmp += c - '0'
        }
    }
    arr[i] = tmp
    return arr
}

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val aaa = readIntArray(n)
    val bbb = readIntArray(n)
    var ans = 0
    for (k in 29 downTo 0) {
        val t1 = 1 shl k
        val t2 = t1 shl 1
        val t3 = t1 + t2
        val mask = t2 - 1
        val bbbMod = bbb.map { it and mask }.toIntArray()
        bbbMod.sort()
        var tmp = 0
        aaa.forEach { a ->
            val am = a and mask
            if (am <= t1) {
                val s1 = bbbMod.bisectLeft(t1 - am)
                val s2 = bbbMod.bisectLeft(t2 - am, fromIndex = s1)
                tmp += s2 - s1
            } else {
                val s2 = bbbMod.bisectLeft(t2 - am)
                val s3 = bbbMod.bisectLeft(t3 - am, fromIndex = s2)
                tmp += s2 + n - s3
            }
        }
        ans = ans shl 1
        ans += tmp and 1
    }
    println(ans)
}

fun IntArray.bisectLeft(x: Int, fromIndex: Int = 0, toIndex: Int = size - 1): Int {
    var l = fromIndex
    var r = toIndex
    while (l <= r) {
        val m = (l + r + 1) / 2
        if (this[m] < x) {
            l = m + 1
        } else {
            r = m - 1
        }
    }
    return l
}
