#include <bits/stdc++.h>
using namespace std;
int a[30000];
int dp[(3000 * 3000) + 100];
int main() {
  int i, j, n;
  dp[0] = 0;
  dp[1] = 1;
  long long mx = 0;
  for (i = 2; i <= (3000 * 3000) + 10; i++) {
    dp[i] = dp[i - 2] + 4;
  }
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  int cnt = 0;
  for (i = 0; i < n; i++)
    for (j = i + 1; j < n; j++) {
      if (a[j] < a[i]) cnt++;
    }
  printf("%d\n", dp[cnt]);
  return 0;
}
