#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const double eps = 1e-9;
const double INF = inf;
const double EPS = eps;
int A[2100], n, e, B[2100], res;
int P[2100], S[2100];
int main() {
  int i;
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d", &A[i]), A[i] = abs(A[i]);
  while (n > 0) {
    int m = -1;
    for (i = 0; i < n; i++) m = max(A[i], m);
    assert(m >= 0);
    if (m == 0) break;
    P[0] = 0;
    for (i = 0; i < n; i++)
      if (i) {
        P[i] = P[i - 1];
        if (A[i - 1] < m) P[i]++;
      }
    S[n - 1] = 0;
    for (i = n - 1; i >= 0; i--)
      if (i != n - 1) {
        S[i] = S[i + 1];
        if (A[i + 1] < m) S[i]++;
      }
    e = 0;
    for (i = 0; i < n; i++) {
      if (A[i] == m)
        res += min(S[i], P[i]);
      else
        B[e++] = A[i];
    }
    for (i = 0; i < e; i++) A[i] = B[i];
    n = e;
  }
  printf("%d\n", res);
  ;
  return 0;
}
