#include #include using namespace std; using uint = unsigned int; uint f(int i, vector& A) { if (i < 0) { return 0; } vector A1, A2; for (uint a : A) { if (((a >> i) & 1)) A1.emplace_back(a); else A2.emplace_back(a); } if (A2.empty()) return f(i - 1, A1); else if (A1.empty()) return f(i - 1, A2); else return min((1 << i) | f(i - 1, A1), (1 << i) | f(i - 1, A2)); } int main() { int N; cin >> N; vector a(N); for (int i = 0; i < N; i++) { cin >> a[i]; } cout << f(31, a) << endl; return 0; }