func_code_string: #include <bits/stdc++.h>   using namespace std;   const int mod = 998244353;   const int inf = 1e9 + 9;   const long long int MOD = 1e9 + 696969;   const long long INF = 4LL * 1000000LL * 1000000LL * 1000000LL;   template <class T>   int size(T &&x) {     return int(x.size());   }   template <class A, class B>   ostream &operator<<(ostream &out, const pair<A, B> &p) {     return out <<  (  << p.first <<  ,   << p.second <<  ) ;   }   template <class T>   auto operator<<(ostream &out, T &&x) -> decltype(x.begin(), out) {     out <<  { ;     for (auto it = x.begin(); it != x.end(); ++it)       out << *it << (it == prev(x.end()) ?    :  ,  );     return out <<  } ;   }   void dump() {}   template <class T, class... Args>   void dump(T &&x, Args... args) {     cerr << x <<  ;   ;     dump(args...);   }   mt19937_64 rng(0);   int random(int l, int r) { return uniform_int_distribution<int>(l, r)(rng); }   inline void addmod(int &x, int val) {     x += val;     while (x >= mod) x -= mod;   }   const int maxn = 300100;   int dr[maxn];   int n, m, tab[maxn];   int N;   int temp[maxn];   inline void add(int p, int val) {     for (; p <= n; p += p & (-p)) dr[p] += val;   }   inline int get(int p) {     if (p == 0) return 0;     int res = 0;     for (; p > 0; p -= p & (-p)) res += dr[p];     return res;   }   map<long long, long long> M;   vector<pair<int, int> > skal;   int cnt = 0;   long long inversions(int base) {     if (M.find(base) != M.end()) return M[base];     skal.resize(n);     ++cnt;     for (int i = (1); i <= (n); ++i) skal[i - 1] = make_pair(tab[i] ^ base, i);     sort(skal.begin(), skal.end());     for (int i = 0; i < n; ++i) temp[skal[i].second] = i + 1;     long long res = 0;     fill(dr, dr + n + 1, 0);     for (int i = n; i > 0; --i) {       res += get(temp[i]);       add(temp[i], 1);     }     M[base] = res;     return res;   }   void solveone() {     cin >> n;     for (int i = (1); i <= (n); ++i) {       cin >> tab[i];     }     int b = 0;     for (int bit = 29; bit >= 0; --bit) {       if (inversions(b) > inversions(b + (1 << bit))) b += (1 << bit);     }     cout << inversions(b) <<     << b <<   n ;   }   int main() {     {       ios_base::sync_with_stdio(false);       cin.tie(0);       cout.tie(0);     };     int tests;     tests = 1;     for (int _ = (1); _ <= (tests); ++_) solveone();   }   