#include <bits/stdc++.h>   using namespace std;   const int M = 1e5 + 10;   const int INF = 0x3f3f3f3f;   const int mod = 998244353;   vector<long long> v;   long long dfs(vector<long long> &v, int bit) {     vector<long long> v0, v1;     if (bit < 0 || v.size() == 0) return 0;     for (long long &j : v) {       if ((j >> bit) & 1)         v1.push_back(j);       else         v0.push_back(j);     }     if (v1.size() == 0) return dfs(v0, bit - 1);     if (v0.size() == 0) return dfs(v1, bit - 1);     return min(dfs(v0, bit - 1), dfs(v1, bit - 1)) + (1 << bit);   }   int main() {     int n;     v.clear();     scanf( %d , &n);     for (int i = 0; i < n; i++) {       long long x;       scanf( %lld , &x);       v.push_back(x);     }     long long ans = dfs(v, 30);     printf( %lld n , ans);     return 0;   }   