#include <bits/stdc++.h>
int main() {
  int n;
  int *a, *b, *c;
  int d = 0;
  int math = 0;
  int i, j;
  int t = 1;
  int y = 0;
  scanf("%d", &n);
  a = (int *)malloc(sizeof(int) * n);
  b = (int *)malloc(sizeof(int) * n);
  for (i = 0; i < n; i++) {
    scanf("%d", a + i);
  }
  for (i = 0; i < n; i++) {
    scanf("%d", b + i);
  }
  c = (int *)malloc(sizeof(int) * n * n);
  for (i = 0; i < n * n; i++) {
    c[i] = a[i / n] + b[i % n];
  }
  for (i = 0; i < n * n; i++) {
    for (j = 1; j < 28; j++) {
      if (pow(2, j) <= c[i]) y = j;
    }
    if (t < y) t = y;
  }
  for (i = 1; i <= t; i++) {
    math = 0;
    for (j = 0; j < n * n; j++) {
      if (c[j] % (int)(pow(2, i)) >= pow(2, i - 1)) math++;
    }
    d = d + (int)pow(2, i - 1) * (math % 2);
  }
  printf("%d", d);
  return 0;
}
