#include <bits/stdc++.h>
using namespace std;
const int N = 100001;
const int mod = (int)(1e9 + 7);
int n, ans, a[2001];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    if (a[i] < 0) a[i] = -a[i];
  }
  for (int i = 1; i <= n; ++i) {
    int before = 0, after = 0;
    for (int j = 1; j < i; ++j) {
      if (a[j] > a[i]) ++before;
      if (a[j] > -a[i]) ++after;
    }
    for (int j = i + 1; j <= n; ++j) {
      if (a[i] > a[j]) ++before;
      if (-a[i] > a[j]) ++after;
    }
    if (after <= before) a[i] = -a[i];
  }
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; j <= n; ++j)
      if (a[i] > a[j]) ++ans;
  cout << ans;
  return 0;
}
