#include <bits/stdc++.h>   using namespace std;   const int N = 3e5 + 10;   long long ans, res;   int L[N], R[N];   int n, a[N];   long long dp[40][2];   void solve(int d, int l, int r) {     if (l >= r) return;     if (d == -1) return;     int nl = 0, nr = 0;     long long tmp1 = 0, tmp2 = 0;     ;     for (int i = l; i <= r; i++) {       if (a[i] >> d & 1)         L[++nl] = a[i], tmp1 += nr;       else         R[++nr] = a[i], tmp2 += nl;     }     dp[d][1] += tmp1;     dp[d][0] += tmp2;     int x = 1, y = 1;     for (int i = l; i <= r; i++) {       if (x <= nl)         a[i] = L[x++];       else         a[i] = R[y++];     }     solve(d - 1, l, l + nl - 1);     solve(d - 1, l + nl, r);   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     solve(30, 1, n);     for (int i = 0; i <= 30; i++) {       if (dp[i][1] < dp[i][0])         ans += dp[i][1], res |= (1 << i);       else         ans += dp[i][0];     }     printf( %lld %lld n , ans, res);   }   