#include <bits/stdc++.h>
using namespace std;
const int INF = (-1u) / 2;
const long long int INF2 = (-1ull) / 2;
int a, b, i, d[10011000], j, k, n, m, timer = 0, l, r, x, y, mp[100010];
int c[1011000], cnt = 0, fl = 0, a2, a3 = -1000000, ans = 0,
                t[2][2010][2010 * 2];
int dp[2][2010];
int N = 2003 * 2;
vector<int> v;
void update(int idx, int id1, int id2) {
  while (idx <= N) {
    t[id1][id2][idx]++;
    idx += (idx & -idx);
  }
}
int take(int idx, int id1, int id2) {
  int sm = 0;
  while (idx > 0) {
    sm += t[id1][id2][idx];
    idx -= (idx & -idx);
  }
  return sm;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> c[i];
  }
  for (i = 0; i < n; i++) {
    for (j = i + 1; j < n; j++) {
      if (c[j] < c[i]) x++;
    }
  }
  d[1] = 1;
  for (i = 2; i <= x; i++) d[i] = d[i - 2] + 4;
  cout << d[x] << endl;
  return 0;
}
