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

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

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,
            std::array<std::vector<unsigned>, 29> &res) {

  using IntType = typename ForwardIt::value_type;
  int max_exp=29;
  std::vector<IntType> work(last-first);
  for (int i=0; i<max_exp; ++i) {
    size_t num[2]={}; 
    for (ForwardIt it=first; it!=last; ++it)
      ++num[((*it)>>i&1)];

    num[1] = num[0];
    num[0] = 0;
    for (ForwardIt it=first; it!=last; ++it)
      work[num[((*it)>>i)&1]++] = *it;
 
    res[i].resize(last-first);
    {
      size_t j=0;
      for (ForwardIt it=first; it!=last; ++it) {
        res[i][j] = (*it = work[j]) & ((2<<i)-1);
        ++j;
      }
    }
  }
}

FastIn::Scanner cin;

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

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

  unsigned res=0;
  for (size_t i=0, pi=1; i<=28; ++i, pi<<=1) {
    size_t i1=0, i2=0, i3=0;
    unsigned cur=0;
    for (size_t j=N; j--;) {
      while (i1 < N && aa[i][j]+bb[i][i1] < 1*pi) ++i1;
      while (i2 < N && aa[i][j]+bb[i][i2] < 2*pi) ++i2;
      while (i3 < N && aa[i][j]+bb[i][i3] < 3*pi) ++i3;

      size_t sj=j+1;
      while (j > 0 && aa[i][j] == aa[i][j-1]) --j;
      cur += ((i2-i1) + (N-i3)) * (sj-j);
    }
    if (cur & 1)
      res |= pi;
  }

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


Measured memory_bytes: 48112