#include using namespace std; int a[100010]; int solve(int L, int R, int shift, int acc){ if(shift < 0){ return acc; } int p = L; for(int i=L;i> shift) & 1){ swap(a[p], a[i]); ++p; } } if(p == L || p == R){ return solve(L, R, shift - 1, acc << 1); } return min( solve(L, p, shift - 1, (acc << 1) | 1), solve(p, R, shift - 1, (acc << 1) | 1) ); } int main(){ int N; cin >> N; for(int i=0;i> a[i]; cout << solve(0, N, 31, 0) << endl; return 0; }