#include <bits/stdc++.h>
using namespace std;
int a[101], d[101];
int m[101][101];
bool mark[101][101];
bool dd[101];
int get(int x, int i) { return x * 100 + (100 - i); }
bool cmp(int x, int y) {
  if (m[x][y] == 2) return true;
  return false;
}
int id[101];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i] >> d[i];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (i != j) {
        if (get(a[i], i) < get(a[j], j)) {
          if (get(a[i] + d[i], i) > get(a[j], j)) {
            m[i][j]++;
            if (get(a[i] + d[i], i) < get(a[j] + d[j], j)) m[i][j]++;
          } else {
            if (get(a[i] + d[i], i) > get(a[j] + d[j], j)) m[i][j]++;
          }
        } else {
          if (get(a[i] + d[i], i) < get(a[j], j)) {
            m[i][j]++;
            if (get(a[i] + d[i], i) > get(a[j] + d[j], j)) m[i][j]++;
          } else {
            if (get(a[i] + d[i], i) < get(a[j] + d[j], j)) m[i][j]++;
          }
        }
      }
  int res = 0;
  for (int i = 1; i <= n; i++) id[i] = i;
  while (true) {
    bool dd = false;
    for (int i = 1; i <= n; i++)
      for (int j = i + 1; j <= n; j++)
        if (m[id[j]][id[i]] == 2) swap(id[i], id[j]), dd = true;
    if (!dd) break;
  }
  for (int i = 1; i <= n; i++)
    for (int j = (int)(i + 1); j <= n; j++) res += m[id[i]][id[j]];
  cout << res;
}
