#include <bits/stdc++.h>
using namespace std;
int n, a[105], d[105];
vector<pair<int, int> > v;
vector<int> v2;
bool cmp(pair<int, int> i, pair<int, int> j) {
  if (i.first == j.first) return i.second < j.second;
  return i.first > j.first;
}
int main() {
  scanf("%d", &n);
  for (int x = 0; x < n; x++) {
    scanf("%d %d", &a[x], &d[x]);
    v.push_back(pair<int, int>(a[x], x));
  }
  sort(v.begin(), v.end(), cmp);
  for (int x = 0; x < n; x++) {
    if (d[v[x].second] <= 0) {
      v2.push_back(v[x].second);
    }
  }
  for (int x = n - 1; x >= 0; x--) {
    if (d[v[x].second] > 0) v2.push_back(v[x].second);
  }
  int ans = 0;
  for (int x = 0; x < n; x++) {
    int cur;
    for (int y = 0; y < n; y++) {
      if (v[y].second == v2[x]) {
        cur = y;
        v[y].first += d[v[y].second];
        break;
      }
    }
    sort(v.begin(), v.end(), cmp);
    for (int y = 0; y < n; y++) {
      if (v[y].second == v2[x]) {
        ans += abs(cur - y);
        break;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
