import java.util.*

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { Integer.parseInt(it) }.toTypedArray()
    val b = readLine()!!.split(" ").map { Integer.parseInt(it) }.toTypedArray()

    var ans = 0
    for (k in 29 downTo 0) {
        var count = 0L
        val powk = 1.shl(k)

        /* this code is assumed answer, but cause TLE :(
         * maybe O(NlogN) *//*
        for (i in 0 until n) {
            val ai = a[i]
            val t1 = b.lowerbound(powk - ai)
            val t2 = b.lowerbound(powk*2 - ai)
            count += t2 - t1
            val t3 = b.lowerbound(powk*3 - ai)
            val t4 = b.size
            count += t4 - t3
        }
        *//* end */

        /* this code is faster than above code, why????????*/
        var r1 = 0
        var r2 = 0
        var r3 = 0
        for (i in n - 1 downTo 0) {
            val ai = a[i]
            while (r1 < n && (ai + b[r1]) < powk) r1 += 1
            while (r2 < n && (ai + b[r2]) < 2 * powk) r2 += 1
            while (r3 < n && (ai + b[r3] < 3 * powk)) r3 += 1
            count += r2 - r1 + n - r3
        }
        /* end */

        for (index in 0 until n) {
            a[index] %= powk
            b[index] %= powk
        }
        a.sort()
        b.sort()

        ans += (count % 2).toInt().shl(k)
    }
    println(ans)
}

fun Array<Int>.lowerbound(key: Int): Int {
    return this.binarySearch(key, Comparator { o1: Int, o2: Int -> if (o1 >= o2) 1 else -1 }).inv()
}