#include using namespace std; #define REP(i, n) for(int(i)=0;(i)<(n);++(i)) int main(){ int N; cin >> N; int a = -1, maxv = 0; REP(i,N){ int M; cin >> M; a &= M; maxv = max(maxv, M); } cout << (maxv^a) << endl; }