#include <bits/stdc++.h>
using namespace std;
template <typename T>
void out(T x) {
  cout << x << endl;
  exit(0);
}
using ll = long long;
const ll mod = 1e9 + 7;
const int maxn = 1e6 + 5;
int n;
int a[maxn], d[maxn];
int score[maxn];
int ranking(int i) {
  int position = 1;
  for (int j = 0; j < n; j++) {
    if (i == j) continue;
    if (score[j] > score[i]) {
      position++;
    }
  }
  return position;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  vector<pair<int, int>> inc, dec;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> d[i];
    a[i] *= 1000;
    a[i] += (n - i);
    d[i] *= 1000;
    if (d[i] >= 0) {
      inc.push_back({a[i], i});
    } else {
      dec.push_back({-a[i], i});
    }
    score[i] = a[i];
  }
  int res = 0;
  sort(inc.begin(), inc.end());
  for (auto p : inc) {
    int i = p.second;
    int before = ranking(i);
    score[i] += d[i];
    int after = ranking(i);
    res += abs(after - before);
  }
  sort(dec.begin(), dec.end());
  for (auto p : dec) {
    int i = p.second;
    int before = ranking(i);
    score[i] += d[i];
    int after = ranking(i);
    res += abs(after - before);
  }
  cout << res << endl;
  return 0;
}
