#include <bits/stdc++.h>
using namespace std;
int a[3000];
int main() {
  int n, max1 = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    max1 = max(a[i], max1);
  }
  cout << (max1 ^ a[n]);
}
