#include <bits/stdc++.h>
using namespace std;
int E[3005 * 3005], A[3005], ans = 0;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> A[i];
    for (int j = 1; j < i; ++j) ans += A[i] < A[j];
  }
  E[0] = 0, E[1] = 1;
  for (int i = 2; i <= ans; ++i) E[i] = E[i - 2] + 4;
  printf("%d\n", E[ans]);
  return 0;
}
