#include using namespace std::literals::string_literals; using i64 = std::int_fast64_t; using std::cout; using std::endl; using std::cin; template std::vector make_v(size_t a){return std::vector(a);} template auto make_v(size_t a,Ts... ts){ return std::vector(ts...))>(a,make_v(ts...)); } std::pair solve(int k, const std::vector& now) { if(k < 0 or now.empty()) return {-(1 << k + 1), 0}; std::vector X, Y; for(auto v: now) { if(v >> k & 1) X.push_back(v); else Y.push_back(v); } auto [x, p] = solve(k - 1, X); auto [y, q] = solve(k - 1, Y); if(x < y) return {x + (1 << k) | (1 << k), p}; return {y + (1 << k), q | (1 << k)}; } int main() { int n; scanf("%d", &n); std::vector a(n); for(int i = 0; i < n; i++) scanf("%d", &a[i]); printf("%d\n", solve(30, a).first); return 0; }