from bisect import bisect_left

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

k = 1
ans = 0
for _ in range(32):
    t = k * 2
    temp_b = sorted([x % t for x in b])
    check = 0
    for temp_a in a:
        x = temp_a % t
        check += bisect_left(temp_b, 2 * k - x) - bisect_left(temp_b, k - x) + bisect_left(temp_b, 4 * k - x) - bisect_left(temp_b, 3 * k - x)
    ans += k * (check % 2)
    k = t

print(ans)
