object Main {
  def binarySearch(arr: Array[Int], value: Int): Int = {
    var i = 0
    var j = arr.length
    var half = (i+j)/2
    if (arr.isEmpty) return 0
    while (i < j) {
      if (arr(half) >= value) {
        j = half
      } else {
        i = half+1
      }
      half = (i+j)/2
    }
    i
  }

  def main(args: Array[String]) = {
    val sc = new java.util.Scanner(System.in)
    val N = sc.nextInt
    val A = new Array[Int](N)
    val B = new Array[Int](N)
    for (i <- 0 until N) A(i) = sc.nextInt
    for (i <- 0 until N) B(i) = sc.nextInt

    var res = 0
    for (i <- (0 to 29).reverse) {
      val (higher, lower) = (1<<(i+1), 1<<i)
      for (j <- 0 until N) {
        A(j) = A(j) % higher
        B(j) = B(j) % higher
      }
      java.util.Arrays.sort(B)
      var loc_sum = 0
      for (k <- 0 until N) {
        if (lower-A(k) >= 0) {
          loc_sum += binarySearch(B, higher-A(k)) 
          loc_sum -= binarySearch(B, lower-A(k))
        } else {
          loc_sum += binarySearch(B, higher-A(k))
          loc_sum += binarySearch(B, higher)
          loc_sum -= binarySearch(B, higher + lower - A(k))
        }
      }
      res += lower*(loc_sum&1)
    }
    println(res)
  }
}
