#include <bits/stdc++.h>
using namespace std;
const int N = 3000;
double rec(int i) {
  if (i == 0) return 0;
  if (i == 1) return 1;
  return 4 + rec(i - 2);
}
int main() {
  int a[N], n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int c = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      if (a[i] > a[j]) c++;
    }
  }
  cout << fixed << setprecision(10) << rec(c) << endl;
  return 0;
}
