#include <bits/stdc++.h>
using namespace std;
ifstream fin("AAtest.in.txt");
int n, jad[2005], e[2005];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cerr.tie(0);
  cin >> n;
  for (int(i) = (0); ((i)) < ((n)); ((i))++) cin >> jad[i];
  vector<int> v;
  for (int(i) = (0); ((i)) < ((n)); ((i))++) {
    int p = abs(jad[i]);
    if (i) {
      int in = 0;
      while (in < v.size() and v[in] < p) in++;
      e[i] = in;
    }
    v.emplace_back(p);
    sort(v.begin(), v.end());
  }
  int vas = 0;
  v.resize(0);
  for (int i = n - 1; i >= 0; i--) {
    int p = abs(jad[i]);
    if (i < n - 1) {
      int in = 0;
      while (in < v.size() and v[in] < p) in++;
      vas += min(in, e[i]);
    }
    v.emplace_back(p);
    sort(v.begin(), v.end());
  }
  cout << vas << endl;
}
