#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3000 * 3000 * 5;
int ans[MAXN];
void fl(int inv) {
  ans[1] = 1;
  for (int i = 2; i <= inv; ++i) ans[i] = 4 + ans[i - 2];
}
int main() {
  int n;
  cin >> n;
  vector<int> t;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    t.push_back(x);
  }
  int inv = 0;
  for (int i = 0; i < n; ++i)
    for (int j = i + 1; j < n; ++j)
      if (t[j] < t[i]) inv++;
  fl(inv);
  cout << ans[inv] << endl;
  return 0;
}
