using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        // TLE解 - しゃくとりならたぶんOK

        public int N;
        public int[] A, B;

        public void Run()
        {
            {
                N = Input.ReadInt();
                A = Input.ReadIntArray();
                B = Input.ReadIntArray();
            }

            long ret = 0;
            int mask = 1 << 29;
            while (mask > 0)
            {
                // Console.Error.WriteLine($"mask:{mask}");

                var A0 = new List<int>();
                var A1 = new List<int>();
                var B0 = new List<int>();
                var B1 = new List<int>();

                for (int i = 0; i < N; i++)
                {
                    if ((A[i] & mask) == mask)
                    {
                        A0.Add(A[i] & (mask - 1));
                    }
                    else
                    {
                        A1.Add(A[i] & (mask - 1));
                    }

                    if ((B[i] & mask) == mask)
                    {
                        B0.Add(B[i] & (mask - 1));
                    }
                    else
                    {
                        B1.Add(B[i] & (mask - 1));
                    }

                }

                A0.Sort();
                A1.Sort();
                B0.Sort();
                B1.Sort();

                long count = 0;
                count += PassCounts(A0, B0, mask);
                count += DownCounts(A1, B0, mask);
                count += DownCounts(A0, B1, mask);
                count += PassCounts(A1, B1, mask);

                if (count % 2 == 1) ret += mask;

                mask /= 2;
            }

            Console.WriteLine(ret);
        }

        public long PassCounts(List<int> A, List<int> B, int m)
        {
            var indexes = PassIndexes(A, B, m);
            return A.LongCount() * B.LongCount() - indexes.Sum();
        }

        public long DownCounts(List<int> A, List<int> B, int m)
        {
            var indexes = PassIndexes(A, B, m);
            return indexes.Sum();
        }

        public long[] PassIndexes(List<int> A, List<int> B, int m)
        {
            var ret = new long[A.Count];
            int b = B.Count;
            for (int a = 0; a < A.Count; a++)
            {
                while (true)
                {
                    if (b > 0 && A[a] + B[b-1] >= m) b--;
                    else break;
                }
                ret[a] = b;
            }

            return ret;
        }

    }
    
    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }

    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}


Measured memory_bytes: 52980