#include using namespace std; int main(void) { int n; unsigned int a[100000]; int b[32] = {0}; unsigned int res = 0; cin >> n; for(int i = 0; i < n; i++) { cin >> a[i]; res = max(res, a[i]); } unsigned int m = 0; for(int i = 0; i < 32; i++) { int mf = -1; for(int j = 0; j < 32; j++) { unsigned int flag = (unsigned int)1 << j; if((m & flag) > 0) continue; m |= flag; unsigned int t = 0; for(int j = 0; j < n; j++) t = max(t, a[j] ^ m); if(t < res) { res = t; mf = j; } m ^= flag; } if(mf == -1) break; m |= 1 << mf; } cout << res << endl; return 0; }