#include <bits/stdc++.h>
using namespace std;
int main() {
  int ans;
  int N, a[200001], b[200001];
  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++) {
      if (i == 0 && j == 0) ans = a[i] + b[j];
      ans ^= (a[i] + b[j]);
    }
  cout << ans;
}
