func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long N = 100010;   long long n, a[N];   double bit[N];   inline void add(long long x, double val) {     for (; x <= n; x += x & -x) bit[x] += val;   }   inline double ask(long long x) {     double sum = 0;     for (; x; x -= x & -x) sum += bit[x];     return sum;   }   int main() {     scanf( %lld , &n);     double tt = 0.0;     for (long long i = 1; i <= n; i++) {       scanf( %lld , a + i);       tt += (ask(n) - ask(a[i]));       add(a[i], 1.0);     }     double ans = 0.0;     for (long long i = 1; i <= n; i++) {       ans += (0.25 * i * (i - 1) + tt) * (n - i + 1);     }     memset(bit, 0, sizeof(bit));     double cur = 0.0;     for (long long i = 1; i <= n; i++) {       double tmp = ask(n) - ask(a[i]) + cur;       ans -= tmp;       add(a[i], i);       cur = tmp;     }     ans = ans / n / (n + 1) * 2.0;     printf( %.12lf n , ans);   }   