#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  int a[200000], b[200000];
  bitset<28> c = static_cast<bitset<28>>(0);
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> b[i];
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      c = c ^ static_cast<bitset<28>>(a[i] + b[j]);
    }
  }
  cout << c.to_ulong() << endl;
  return 0;
}
