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