### BUGGY CODE ###

# coding: utf-8
# Your code here!

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline 

n = int(input())
a = [int(i) for i in readline().split()]
b = [int(i) for i in readline().split()]

from bisect import *
from itertools import accumulate

def f(a,b,k,cnta,accb): #k桁目のxor
    p1 = 1<<k
    p2 = p1<<1
    p3 = p1+p2
    b = sorted(i&(p2-1) for i in b)
    
    res = 0
    if k > N:
        for ai in a:
            ai &= (p2-1)
            if p1 > b[0]: j1 = bisect_left(b,p1-ai)
            else: j1 = 0
            j2 = bisect_left(b,p2-ai)
            if p3 - ai > b[-1]: j3 = n
            else: j3 = bisect_left(b,p3-ai)
            res += j2-j1+n-j3
        return (res&1)<<k
    else:
        for ai,num in enumerate(cnta):
            if num == 0: continue
            
            #print(cnta,accb,p1,p2,p3,ai+1)
            if p1-ai-1 < 0:
                j1 = 0
            else:
                j1 = accb[p1-ai-1]
            if p2-ai-1 < 0:
                j2 = 0
            else:
                j2 = accb[p2-ai-1]
            if p3-ai-1 < 0:
                j3 = 0
            else:
                j3 = accb[p3-ai-1]
            res += num*(j2-j1+n-j3)
            
            #print(res,cnta,accb,p1,j1,j2,j3,n)
        return (res&1)<<k
            






N = 17
cnta = 0
accb = [0]

ans = 0
for k in range(28,-1,-1):
    if k == N:
        N2 = 1<<(N+1)
        cnta = [0]*N2
        cntb = [0]*N2
        N2 -= 1
        for i in a: cnta[i&N2] += 1
        for i in b: cntb[i&N2] += 1
        accb = list(accumulate(cntb)) + [n]*(N2+1)
        
        """
        N2 = 1<<(N+2)
        cntb = [0]*(N2)
        N2 -= 1
        for i in b: cntb[i&N2] += 1
        accb = list(accumulate(cntb))
        """
    if k < N:
        cnta = [i+j for i,j in zip(cnta[:(1<<(k+1))],cnta[(1<<(k+1)):])]
        cntb = [i+j for i,j in zip(cntb[:(1<<(k+1))],cntb[(1<<(k+1)):])]
        accb = list(accumulate(cntb)) + [n]*(1<<(k+1))
        
    #print(cnta)
    ans |= f(a,b,k,cnta,accb)

print(ans)    









### FIXED CODE ###

# coding: utf-8
# Your code here!

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline 

n = int(input())
a = [int(i) for i in readline().split()]
b = [int(i) for i in readline().split()]

from bisect import bisect_left


ans = 0

for k in range(29):
    a0 = []
    a1 = []
    a0a = a0.append
    a1a = a1.append
    
    b0 = []
    b1 = []
    b0a = b0.append
    b1a = b1.append
    for i in a: #基数ソート
        if i&(1<<k): a1a(i)
        else: a0a(i)
    for i in b: #基数ソート
        if i&(1<<k): b1a(i)
        else: b0a(i)
    
    a = a0+a1
    b = b0+b1
    mask = (1<<(k+1))-1
    
    aa = [i&mask for i in a]
    bb = [i&mask for i in b]
    
    res = 0
    p1 = 1<<k
    p2 = mask+1
    p3 = p1+p2

    j1=j2=j3=0    
    for ai in reversed(aa):
        while j1 < n and ai+bb[j1] < p1:
            j1 += 1
        while j2 < n and ai+bb[j2] < p2:
            j2 += 1
        while j3 < n and ai+bb[j3] < p3:
            j3 += 1
        res += j2-j1+n-j3
        #if k < 3: print(ai,p2,res,bb,j1,j2,j3,n)
        #print(bb,p2,ai,j1,j2,j3,n,"R",res)    
    ans |= (res&1)<<k
    



print(ans)