#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, mi, ma, num;
  cin >> n >> ma;
  mi = ma;
  for (int i = 1; i < n; ++i) {
    cin >> num;
    ma = max(ma, num);
    mi = num;
  }
  cout << (mi ^ ma);
  return 0;
}
