func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 100;   int n, a[N];   long long s[2][N];   double Ans;   void Add(int tp, int x, long long sum) {     while (x <= n) s[tp][x] += sum, x += (x & (-x));   }   long long Query(int tp, int x) {     long long ret = 0;     while (x) ret += s[tp][x], x -= (x & (-x));     return ret;   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; ++i) scanf( %d , &a[i]);     for (int i = 1; i <= n; ++i) {       Ans += 1.0 * Query(0, n - a[i] + 1) / (1.0 * n * (n + 1)) * i;       Ans += 1.0 * i * (n - i + 1) * (n - i) / (2.0 * n * (n + 1));       Add(0, n - a[i] + 1, 2 * i);     }     for (int i = 1; i <= n; ++i) {       Ans += 1.0 * Query(1, n - a[i] + 1) / (1.0 * n);       Add(1, n - a[i] + 1, n - 2 * i);     }     printf( %.10lf , Ans);     return 0;   }   