#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
long long n, a[100000], x;
int32_t main() {
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> a[i];
  x = a[n - 1];
  sort(a, a + n);
  cout << (x ^ a[n - 1]);
  return 0;
}
