#include <cstdio>
#include <cstring>
#include <cstdint>
#include <cstdlib>
#include <cstddef>
#include <cinttypes>

#include <type_traits>
#include <limits>
#include <vector>
#include <algorithm>
#include <functional>

namespace FastIn {
  static constexpr size_t BUF_SIZE=1<<17, INT_LEN=24, FLT_LEN=400;
  static char buf[BUF_SIZE|1]={}, *pos=buf, *endbuf=nullptr;
  FILE *fin;
 
  inline bool rebuffer() {
    // returns true <=> there is at least one unread character
    size_t rest=endbuf-pos;
    if (buf+rest > pos) {
      // buf[:pos] and buf[-pos:] are overlapping, which std::memcpy()
      // causes undefined behavior.
      return true;
    }
 
    std::memcpy(buf, pos, rest); 
    pos = buf;
    size_t len=std::fread(pos+rest, 1, BUF_SIZE-rest, fin);
    *(endbuf = buf + (rest+len)) = 0;
 
    return *pos;
  }
 
  template <class Int>
  inline bool scan(Int &in) {
    in = 0;
 
    // assume that no redundant whitespace appears
    if (pos + INT_LEN >= endbuf && !rebuffer()) {
      return false;
    }
 
    if (std::is_signed<Int>::value) {
      if (*pos == '-') {
        in = ~*++pos+'1';
        while (*++pos >= '0') {
          in = in*10 + ~*pos+'1';
        }
        ++pos;
        return true;
      }
    }
 
    // assume that numbers are separated by the character whose value is
    // less than '0' (e.g. whitespaces, newlines)
    do {
      in = in*10 + *pos-'0';
    } while (*++pos >= '0');
    ++pos;
    return true;
  }
 
  class Scanner {
    bool rebuffer() {
      return FastIn::rebuffer();
    }
 
  public:
    Scanner(FILE *fin=stdin) {
      FastIn::fin = fin;
      endbuf = pos + std::fread(buf, 1, BUF_SIZE, fin);
    }
 
    template <class T>
    inline bool scan(T &in) {
      return FastIn::scan(in);
    }
 
    template <class First, class... Rest>
    inline bool scan(First &in, Rest &...ins) {
      return scan(in) && scan(ins...);
    }
  };
}

template <class ForwardIt>
void rxsort(ForwardIt first, ForwardIt last,
            const int max_exp=8*(sizeof (typename ForwardIt::value_type))) {

  using IntType = typename ForwardIt::value_type;
  std::vector<IntType> work(last-first);
  for (int i=0; i<max_exp; i+=8) {
    size_t num[256]={};
 
    for (ForwardIt it=first; it!=last; ++it)
      ++num[((*it)>>i)&255];
 
    {
      size_t tmp=0;
      for (int j=0; j<256; ++j)
        std::swap(tmp, num[j]+=tmp);
    }
 
    for (ForwardIt it=first; it!=last; ++it)
      work[num[((*it)>>i)&255]++] = *it;
 
    {
      size_t j=0;
      for (ForwardIt it=first; it!=last; ++it)
        *it = work[j++];
    }
  }
}

FastIn::Scanner cin;

int main() {
  size_t N;
  cin.scan(N);

  std::vector<unsigned> a(N), b(N);
  for (size_t i=0; i<N; ++i) cin.scan(a[i]);
  rxsort(a.begin(), a.end());
  for (size_t i=0; i<N; ++i) cin.scan(b[i]);
  rxsort(b.begin(), b.end());

  unsigned res=0;
  for (unsigned i=(1<<28), k=28; i; i>>=1, --k) {
    if (a.back() + b.back() < i)
      continue;

    size_t i1=0, i2=0, i3=0;
    unsigned cur=0;
    for (size_t j=N; (j-- && i1<N);) {
      while (i1 < N && a[j]+b[i1] < 1*i) ++i1;
      while (i2 < N && a[j]+b[i2] < 2*i) ++i2;
      cur += (i2-i1);
    }
    for (size_t j=N; (j-- && i3<N);) {
      while (i3 < N && a[j]+b[i3] < 3*i) ++i3;
      cur += (N-i3);
    }

    if (cur & 1)
      res |= i;

    for (size_t j=0; j<N; ++j) {
      a[j] &= i-1;
      b[j] &= i-1;
    }
    rxsort(a.begin(), a.end(), k);
    rxsort(b.begin(), b.end(), k);
  }

  printf("%u\n", res);
}


Measured memory_bytes: 2688