func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = (int)5e6 + 100;   const int maxm = (int)1e6 + 100;   const int mod = (int)1e9 + 7;   const int P = (int)1e6 + 7;   const double pi = acos(-1.0);   int n, t[2][maxn], id = 1;   long long dp[2][30];   vector<int> g[maxn];   void add(int x, int pos) {     int v = 0;     for (int i = (29); i >= (0); --i) {       int bit = ((x >> i) & 1);       if (!t[bit][v]) t[bit][v] = id++;       v = t[bit][v];       g[v].push_back(pos);     }   }   void go(int v, int b = 29) {     int l = t[0][v], r = t[1][v];     if (l) go(l, b - 1);     if (r) go(r, b - 1);     if (!l || !r) return;     long long res = 0;     int ptr = 0;     for (auto x : g[l]) {       while (ptr < ((int)(g[r]).size()) && g[r][ptr] < x) ptr++;       res += ptr;     }     dp[0][b] += res;     dp[1][b] += ((int)(g[l]).size()) * 1ll * ((int)(g[r]).size()) - res;   }   void solve() {     scanf( %d , &n);     for (int i = (1); i <= (n); ++i) {       int x;       scanf( %d , &x);       add(x, i);     }     go(0);     long long inv = 0;     int res = 0;     for (int i = (0); i <= (29); ++i) {       inv += min(dp[0][i], dp[1][i]);       if (dp[1][i] < dp[0][i]) res += (1 << i);     }     printf( %lld %d , inv, res);   }   int main() {     int t = 1;     while (t--) solve();   }   