#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k, n;
  scanf("%d", &n);
  int a[n];
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  int sp = 0;
  for (i = 0; i < n; i++) {
    for (j = 0; j < i; j++) {
      if (a[i] < a[j]) sp++;
    }
  }
  sp = sp + sp - sp % 2;
  sp = max(0, sp);
  printf("%d.00000000000000000000000", sp);
  return 0;
}
