#include <bits/stdc++.h>   using namespace std;   int v[3005], inv = 0, n;   double sol;   int main() {     cin >> n;     for (int i = 1; i <= n; i++) cin >> v[i];     for (int i = 1; i <= n; i++)       for (int j = i + 1; j <= n; j++)         if (v[i] > v[j]) inv++;     sol = double(inv) - inv / 2 + (inv / 2) * 3.0;     cout << fixed;     cout << setprecision(6);     cout << sol <<   n ;     return 0;   }   