/**
  * Created by 80011714 on 2018/3/21.
  */

import scala.collection.mutable.ArrayBuffer

object xor extends App {

  def compute(left: Seq[Int], right: Seq[Int]) = {
    var numbers = for (x <- left; y <- right) yield (x + y)

//    println(numbers.mkString(","))

    val bits = ArrayBuffer.empty[Int]

    while (numbers.nonEmpty) {
      bits.append(numbers.map(_ % 2).sum % 2)
      numbers = numbers.map(_ / 2).filter(_ > 0)
    }

    var result = 0.0
    for (i <- Range(0, bits.size)) {
//      println(bits(i))
      result = result + (bits(i) * math.pow(2, i))
    }
    println(result.toInt)
  }

  def main(args: Array[String]): Unit = {
    import java.io.BufferedReader
    import java.io.InputStreamReader
    val br = new BufferedReader(new InputStreamReader(System.in))

    val N = br.readLine().toInt

    val left = br.readLine().split(" ").map(_.toInt)
    val right = br.readLine().split(" ").map(_.toInt)

    compute(left, right)

  }

}
