func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = (1 << 20) + 50;   const int MAXLOG = 21;   long long int a[MAXN];   long long int data[MAXLOG][MAXN];   long long int answer[2][MAXN];   long long int n;   void build(int s = 0, int e = (1 << n), int h = 0) {     if (e - s < 2) {       data[h][s] = a[s];       return;     }     int mid = (s + e) / 2;     build(s, mid, h + 1);     build(mid, e, h + 1);     merge(data[h + 1] + s, data[h + 1] + mid, data[h + 1] + mid, data[h + 1] + e,           data[h] + s);     for (int i = s; i < mid; i++) {       long long int now = lower_bound(data[h + 1] + mid, data[h + 1] + e, a[i]) -                           (data[h + 1] + mid);       answer[0][h] += now;     }     for (int i = mid; i < e; i++) {       long long int now = lower_bound(data[h + 1] + s, data[h + 1] + mid, a[i]) -                           (data[h + 1] + s);       answer[1][h] += now;     }   }   int main() {     scanf( %I64d , &n);     for (int i = 0; i < (1 << n); i++) {       scanf( %I64d , a + i);     }     build();     long long int q;     scanf( %I64d , &q);     while (q--) {       long long int ans = 0;       long long int cur;       scanf( %I64d , &cur);       for (int i = n - cur; i < n; ++i) {         swap(answer[0][i], answer[1][i]);       }       for (int i = 0; i < n; i++) {         ans += answer[0][i];       }       printf( %I64d n , ans);     }   }   