object Main extends App {
	val n = scala.io.StdIn.readInt
	val a = scala.io.StdIn.readLine.split(" ").map(_.toLong).sorted
	val b = scala.io.StdIn.readLine.split(" ").map(_.toLong).sorted

	var ans = 0L
	var cnt = 0L

	for(i<-0 to 30){
		val t = 0x1 << i

		val am = a.map(_ % (0x1 << (i+1)))
		val bm = b.map(_ % (0x1 << (i+1))).sorted

		cnt = 0

		for(j<-0 until n){
			val T1 = t - am(j)
			val T2 = 2*t - am(j)
			val T3 = 3*t - am(j)
			val T4 = 4*t - am(j)

			cnt += bm.filter(_ < T2).filter(_ >= T1).size + bm.filter(_ < T4).filter(_ >= T3).size  
		}

		if(cnt%2 == 1){
			ans += t
		}
	}

	println(ans)
}