#include <bits/stdc++.h>
using namespace std;
const int INF = 2000000000;
int data[2010];
int used[2010];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &data[i]);
    data[i] = abs(data[i]);
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int max_data = -INF;
    int max_j = -1;
    for (int j = 0; j < n; j++) {
      if (used[i] == 0 && max_data <= data[i]) {
        max_data = data[i];
        max_j = i;
      }
    }
    int tmp_count1 = 0;
    int tmp_count2 = 0;
    for (int j = 0; j < max_j; j++) {
      if (data[j] < max_data) {
        tmp_count2++;
      }
    }
    for (int j = max_j + 1; j < n; j++) {
      if (data[j] < max_data) {
        tmp_count1++;
      }
    }
    if (tmp_count1 > tmp_count2) {
      ans += tmp_count2;
    } else {
      ans += tmp_count1;
    }
  }
  printf("%d\n", ans);
}
