import Foundation
class Inputer {
    var buffer: String
    var items: [String]
    var cnt: Int
    init() {
        buffer = ""
        var s: String? = readLine()
        while (s != nil) {
            buffer = (buffer.characters.count > 0 ? buffer + " " : "") + s!
            s = readLine()
        }
        cnt = 0
        items = buffer.characters.split{$0 == " "}.map(String.init)
    }
    func getInt() -> Int {
        let str = String(items[cnt])
        cnt += 1
        return Int(str)!
    }
    func getIntArray(t: Int) -> [Int] {
        var r = [Int]()
        for _ in 0..<t { r += [getInt()] }
        return r
    }
    func getStr() -> String {
        let str = String(items[cnt])
        cnt += 1
        return str
    }
    func getStrArray(t: Int) -> [String] {
        var r = [String]()
        for _ in 0..<t { r += [getStr()] }
        return r
    }
}
func lowerBound(a: [Int], _ v: Int) -> Int {
    var l = 0, r = a.count - 1
    while (r - l >= 0) {
        let c = (l + r) >> 1
        if (v <= a[c]) {
            r = c - 1
        } else {
            l = c + 1
        }
    }
    return l
}

let cin = Inputer()
let N = cin.getInt(), A = cin.getIntArray(N), B = cin.getIntArray(N)
var a = [Int](), b = [Int]()
for i in 0..<N {
    a += [0]
    b += [0]
}
var ans = 0
for k in 0..<29 {
    var count = 0
    let T = 1 << k
    let mask = T << 1
    for i in 0..<N {
        a[i] = A[i] % mask
        b[i] = B[i] % mask
    }
    b.sortInPlace()
    for i in 0..<N {
        let f1 = lowerBound(b, T - a[i])
        let t1 = lowerBound(b, (T << 1) - a[i])
        let f2 = lowerBound(b, 3 * T - a[i])
        let t2 = lowerBound(b, (T << 2) - a[i])
        count += t1 - f1
        count %= 2
        count += t2 - f2
        count %= 2
    }
    if (count == 1) {
        ans |= 1 << k
    }
}
print(ans)