#include <bits/stdc++.h>
using namespace std;
int a[1000000], b, c, n, m, x, y, z, s;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  x = a[n];
  sort(a + 1, a + 1 + n);
  y = x ^ a[n];
  cout << y;
  return 0;
}
