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