import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;

int [] a;
int [] b;



void main() {
  int n;
  readf (" %d", &n);
  int [] a = new int[n];
  int [] b = new int[n];
  foreach (i; 0 .. n) {
    readf (" %d", &a[i]);
  }
  foreach (i; 0 .. n) {
    readf (" %d", &b[i]);
  }
  int res = 0;

  int [] c = new int[n];
  int [] d = new int[n];

  foreach (k; 0 .. 30) {
    int mask = (1 << (k + 1)) - 1;  
    foreach (i; 0 .. n) {
      c[i] = a[i] & mask;
      d[i] = b[i] & mask;
    }
    //c.sort ();
    d.sort ();
    
    auto z = d.assumeSorted;
    int u = 1 << k;
    int v = 2 * u - 1;
    auto rr = 0;
    foreach (i; 0 .. n) {
      int f = (u - c[i]) & mask;
      int g = (v - c[i]) & mask;
      auto r = (f <= g) ? 
               z.lowerBound (g + 1).length - z.lowerBound (f).length :
               n - (z.lowerBound (f).length  - z.lowerBound (g + 1).length);

      rr += r;
      }
    if ((rr & 1) != 0) {
      res += 1 << k;
    }
  }
  writeln (res);
}
