#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } const long long MAX = 5100000; const long long INF = 1LL << 60; const long long MOD = 1'000'000'007LL; //const long long mod = 998244353LL; using namespace std; typedef unsigned long long ull; typedef long long ll; ll N; set S; vector v; int hoge(ll d, vector& v) { if (v.size() <= 1) return 0; int i, j; vector w[2]; for (ll i = 0; i < v.size(); i++) { int x = v[i]; w[(x >> d) & 1].push_back(x ^ (x&(1 << d))); } if (w[0].size() == 0) return hoge(d - 1, w[1]); if (w[1].size() == 0) return hoge(d - 1, w[0]); return (1 << d) + min(hoge(d - 1, w[0]), hoge(d - 1, w[1])); } void solve() { string s; cin >> N; ll x; for(ll i=0;i> x, S.insert(x); for(auto p : S) v.push_back(p); cout << hoge(40, v) << endl; } int main() { /* cin.tie(nullptr); ios::sync_with_stdio(false); */ solve(); return 0; }