#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int MOD = 1000000007;
const int inf = (1 << 30) - 1;
const ll INF = (1LL << 60) - 1;
template <typename T>
bool chmax(T &x, const T &y) {
  return (x < y) ? (x = y, true) : false;
};
template <typename T>
bool chmin(T &x, const T &y) {
  return (x > y) ? (x = y, true) : false;
};
struct io_setup {
  io_setup() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout << fixed << setprecision(15);
  }
} io_setup;
int main() {
  int N;
  cin >> N;
  vector<int> p(N);
  for (int i = 0; i < N; i++) {
    cin >> p[i];
    p[i] = abs(p[i]);
  }
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    if (p[i] == 0) {
      a[i] = 0;
      continue;
    }
    int l = 0, r = 0;
    for (int j = 0; j < i; j++) {
      if (p[j] < p[i] || a[j] == p[i]) l++;
    }
    for (int j = i + 1; j <= N - 1; j++) {
      if (p[j] < p[i]) r++;
    }
    if (r >= l)
      a[i] = -p[i];
    else
      a[i] = p[i];
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < i; j++) {
      if (a[j] > a[i]) ans++;
    }
  }
  cout << ans << '\n';
}
