#include <cstdint>
#include <set>
#include <vector>
#include <iostream>

using i64 = long long;

class bitvector {
  using bit_type = std::uint_least64_t;
  using size_type = std::size_t;
  static constexpr size_type wordsize = 64;
  
  std::vector<bit_type> bit;
  std::vector<size_type> sum;
  
public:

  bitvector() : bit(), sum() {} 
  bitvector(const size_type size)
    : bit(size / wordsize + 1, 0), sum(size / wordsize + 1, 0) {}

  void set(const size_type i) {
    bit[i / wordsize] |= static_cast<bit_type>(1) << (i % wordsize);
  }
  void build() {
    for (size_type i = 1; i < bit.size(); i++) {
      sum[i] = sum[i - 1] + __builtin_popcountll(bit[i - 1]);
    }
  }

  size_type at(const size_type i) const {
    return bit[i / wordsize] >> (i % wordsize);
  }

  // count of ones in [0, i)
  size_type rank(const size_type i) const {
    return sum[i / wordsize]
      + __builtin_popcountll(bit[i / wordsize] & (static_cast<bit_type>(1) << (i % wordsize)) - 1);
  }

  // count of ones in [0, i)
  size_type rank(const size_type i, const size_type b) const {
    size_type ans = sum[i / wordsize]
      + __builtin_popcountll(bit[i / wordsize] & (static_cast<bit_type>(1) << (i % wordsize)) - 1);
    if(b) return ans;
    else return i - ans;
  }
};

class wavelet_matrix {
  using Integer = i64;
  using integer_type = Integer;
  using size_type = std::size_t;


  const size_type depth;
  const size_type len;
  std::vector<bitvector> mat;
  std::vector<size_type> spl;

public:

  wavelet_matrix(const std::vector<integer_type>& arr, size_type de)
    : depth(de),
      len(arr.size()),
      mat(std::vector<bitvector>(depth, bitvector(arr.size()))),
      spl(std::vector<size_type>(depth, 0)) {
        std::vector<size_type> idx(len);
        std::vector<size_type> left(len), right(len);
        for(size_type i = 0;i < len;i++) idx[i] = i;
        for(size_type d = depth; d-- > 0;) {
          size_type l = 0, r = 0;
          
          for(size_type i = 0; i < len; i++) {
            size_type k = (arr[idx[i]] >> d) & 1;
            if(k) right[r++] = idx[i], mat[d].set(i);
            else left[l++] = idx[i];
          }
          mat[d].build();
          spl[d] = l;
          swap(idx, left);
          for(size_type i = 0; i < r; i++) idx[i + l] = right[i];
        }
      }

  integer_type at(size_type i) const {
    integer_type x = static_cast<integer_type>(0);
    for(size_type d = depth; d-- > 0;) {
      size_type k = mat[d].at(i);
      x |= (static_cast<integer_type>(k) << d);
      i = mat[d].rank(i, k) + spl[d] * k;
    }
    return x;
  }

  size_type rank_x(size_type left, size_type right, integer_type x) const {
    for(size_type d = depth; d-- > 0;) {
      size_type k = ((x >> d) & 1);
      left = mat[d].rank(left, k) + spl[d] * k;
      right = mat[d].rank(right, k) + spl[d] * k;
    }
    return right - left;
  }

  integer_type quantile(size_type left, size_type right, size_type i) const {
    integer_type x = static_cast<integer_type>(0);
    for(size_type d = depth; d-- > 0;) {
      size_type cnt = mat[d].rank(right, 0) - mat[d].rank(left, 0);
      size_type k = (i < cnt) ? 0 : 1;
      x |= (k << d);
      left = mat[d].rank(left, k) + spl[d] * k;
      right = mat[d].rank(right, k) + spl[d] * k;
    }
    return x;
  }

  size_type greater_eq(size_type left, size_type right, integer_type x) const {
    size_type cnt = 0;
    for(size_type d = depth; d-- > 0;) {
      size_type k = ((x >> d) & 1);
      size_type rl = mat[d].rank(left, 1);
      size_type rr = mat[d].rank(right, 1); 
      if(k == 0) {
        cnt += rr - rl;
        left -= rl;
        right -= rr;
      }
      else {
        left = rl + spl[d];
        right = rr + spl[d];
      }
    }
    return cnt + right - left;
  }

  size_type rangefreq(size_type left, size_type right, integer_type x, integer_type y) const {
    return greater_eq(left, right, x) - greater_eq(left, right, y);
  }

  size_type greater(size_type left, size_type right, integer_type x) const {
    size_type cnt = 0;
    for(size_type d = depth; d-- > 0;) {
      size_type k = ((x >> d) & 1);
      size_type rl = mat[d].rank(left, 1);
      size_type rr = mat[d].rank(right, 1); 
      if(k == 0) {
        cnt += rr - rl;
        left -= rl;
        right -= rr;
      }
      else {
        left = rl + spl[d];
        right = rr + spl[d];
      }
    }
    return cnt;
  }
};

#include <type_traits>
#include <vector>
using i64 = long long;

template<class Iterator> class jter;
template<class Jter> class rev_jter;
template<class Jter, class F> class map_jter;

template<class Iterator>
class jter {

  Iterator b;
  Iterator e;

public:

  using iterator = jter<Iterator>;
  using value_type = typename Iterator::value_type;
  using difference_type = std::ptrdiff_t;
  using pointer = value_type*;
  using reference = value_type&;
  using iterator_category = std::bidirectional_iterator_tag;

  jter() {}
  jter(Iterator b, Iterator e) : b(b), e(e) {}

  void next() { b++; }
  void prev() { --e; }
  value_type& front() { return *b; }
  value_type& back() { auto c = e; return *(--c); }
  bool isnone() const { return b == e; }

  jter begin() const { return *this; }
  jter end() const { return jter(); }
  jter& operator++() { next(); return *this; }
  value_type& operator*() { return front(); }
  bool operator!=(const jter& other) const { return !isnone(); }

  rev_jter<jter<Iterator>> rev() const { return rev_jter<jter<Iterator>>(*this); }
  template<class F>
  map_jter<jter<Iterator>, F> map(F f) const { return map_jter<jter<Iterator>, F>(*this, f); }
  std::vector<value_type> tovec() const { return std::vector<value_type>(this->begin(), this->end()); }
};

template<class Jter>
class rev_jter {

  Jter j;

public:

  using iterator = rev_jter<Jter>;
  using value_type = typename Jter::value_type;
  using difference_type = std::ptrdiff_t;
  using pointer = value_type*;
  using reference = value_type&;
  using iterator_category = std::bidirectional_iterator_tag;

  rev_jter() {}
  rev_jter(Jter j): j(j) {}

  void next() { j.prev(); }
  void prev() { j.next(); }
  value_type& front() { return j.back(); }
  value_type& back() { return j.front(); }
  bool isnone() const { return j.isnone(); }

  rev_jter begin() const { return *this; }
  rev_jter end() const { return rev_jter(); }
  rev_jter& operator++() { next(); return *this; }
  value_type& operator*() { return front(); }
  bool operator!=(const rev_jter& other) const { return !isnone(); }

  Jter rev() const { return j; }
  template<class F>
  map_jter<rev_jter, F> map(F f) const { return map_jter<rev_jter, F>(*this, f); }
};

template<class Jter, class F>
class map_jter {

  Jter j;
  union _u {
    F f;
    bool isend;
    _u(): isend(true) {} 
    _u(F f): f(f) {}
  } u;

public:

  using iterator = rev_jter<Jter>;
  using value_type = decltype(std::declval<F>()(std::declval<typename Jter::value_type>()));
  using difference_type = std::ptrdiff_t;
  using pointer = value_type*;
  using reference = value_type&;
  using iterator_category = std::bidirectional_iterator_tag;

  map_jter() {}
  map_jter(Jter j, F f): j(j), u(f) {}

  void next() { j.next(); }
  void prev() { j.prev(); }
  value_type front() { return u.f(j.front()); }
  value_type back() { return u.f(j.back()); }
  bool isnone() const { return j.isnone(); }

  map_jter begin() const { return *this; }
  map_jter end() const { return map_jter(); }
  map_jter& operator++() { next(); return *this; }
  value_type operator*() { return front(); }
  bool operator!=(const map_jter& other) const { return !isnone(); }

  Jter rev() const { return j; }
  template<class G>
  map_jter<map_jter, G> map(F f) const { return map_jter<map_jter, G>(*this, f); }
  std::vector<value_type> tovec() const { return std::vector<value_type>(this->begin(), this->end()); }
};

class range {

  i64 b;
  i64 e;

public:

  using iterator = range;
  using value_type = i64;
  using difference_type = std::ptrdiff_t;
  using pointer = value_type*;
  using reference = value_type&;
  using iterator_category = std::bidirectional_iterator_tag;

  range() {}
  range(i64 n) : b(0), e(n) {}
  range(i64 b, i64 e) : b(b), e(e) {}

  value_type next() { return b++; }
  value_type prev() { return --e; }
  value_type front() { return b; }
  value_type back() { return e - 1; }
  bool isnone() const { return b == e; }

  range begin() const { return *this; }
  range end() const { return range(); }
  range& operator++() { next(); return *this; }
  value_type operator*() { return front(); }
  bool operator!=(const range& other) const { return !isnone(); }

  rev_jter<range> rev() const { return rev_jter<range>(*this); }

  template<class F>
  map_jter<range, F> map(F f) const { return map_jter<range, F>(*this, f); }

  std::vector<value_type> tovec() const { return std::vector<value_type>(this->begin(), this->end()); }
};

template<class Iterator>
jter<Iterator> jtr(Iterator b, Iterator e) { return jter<Iterator>(b, e); }

template<class V>
jter<typename V::iterator> jtr(V& v) { return jter<typename V::iterator>(begin(v), end(v)); }

template<class V>
jter<typename V::const_iterator> cjtr(const V& v) { return jter<typename V::const_iterator>(cbegin(v), cend(v)); }



#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()

template<class T>
T input() { T t; cin >> t; return t; }

int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(nullptr);
  const i64 n = input<i64>();
  auto a = range(n).map([](i64 x) { return input<i64>(); }).tovec();
  auto b = range(n).map([](i64 x) { return input<i64>(); }).tovec();

  i64 ans = 0;

  if(n & 1) {
    for(auto x: jtr(a)) ans ^= x;
    for(auto x: jtr(b)) ans ^= x;
  }

  vector<i64> c(n);

  for(i64 i: range(28)) {
    i64 bit = 1 << (i + 1);
    wavelet_matrix wm(jtr(b).map([bit](i64 x) { return x & (bit - 1); }).tovec(), i + 1);
    for(auto x: jtr(a)) {
      if(wm.greater(0, n, ~x&(bit - 1)) & 1) ans ^= bit;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 12676