#include #define rep(i, a) for (int i = 0; i < (a); i++) #define rep2(i, a, b) for (int i = (a); i < (b); i++) #define repr(i, a) for (int i = (a) - 1; i >= 0; i--) #define repr2(i, a, b) for (int i = (b) - 1; i >= (a); i--) using namespace std; typedef long long ll; const ll inf = 1e9; const ll mod = 1e9 + 7; int N; ll a[100000]; int main() { cin >> N; rep (i, N) cin >> a[i]; ll lb = *max_element(a, a + N); ll x = 0; repr (i, 32) { ll maxv = 0; ll y = x | (1ll << i); rep (j, N) { maxv = max(maxv, a[j] ^ y); } if (maxv < lb) { lb = maxv; x = y; } } cout << lb << endl; return 0; }