#include #include #define int long long using namespace std; int n; int a[100000]; //[l, r) int dfs(int l, int r, int ind) { if (ind < 0) return 0; int i; for (i = l; i < r; i++) if ((a[i] >> ind) % 2) break; if (i == l || i == r) return dfs(l, r, ind - 1); return (1LL << ind) + min(dfs(l, i, ind - 1), dfs(i, r, ind - 1)); } signed main() { cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; cout << dfs(0, n, 35) << endl; return 0; }