#include <bits/stdc++.h>
using namespace std;
int n, mtx[105][105], cnt[105], omg[105];
int a[105], d[105];
bool surv[105];
int main() {
  scanf("%d", &n);
  for (int i = (1); i <= (n); i++) {
    scanf("%d %d", &a[i], &d[i]);
    a[i] = a[i] * 101 - i;
    d[i] *= 101;
  }
  for (int i = (1); i <= (n); i++)
    for (int j = (i + 1); j <= (n); j++) {
      int p = a[i], q = a[i] + d[i], r = a[j], s = a[j] + d[j];
      int c1 = 0, c2 = 0;
      if (min(p, q) < r && max(p, q) > r) c1++;
      if (min(r, s) < q && max(r, s) > q) c1++;
      if (min(r, s) < p && max(r, s) > p) c2++;
      if (min(p, q) < s && max(p, q) > s) c2++;
      mtx[i][j] = c1;
      mtx[j][i] = c2;
    }
  for (int i = (1); i <= (n); i++) surv[i] = true;
  int res = 0;
  for (int u = (1); u <= (n); u++) {
    for (int i = (1); i <= (n); i++) cnt[i] = 0, omg[i] = 0;
    for (int i = (1); i <= (n); i++)
      for (int j = (1); j <= (n); j++)
        if (surv[i] && surv[j]) {
          cnt[i] += mtx[i][j];
          if (mtx[i][j] == 2) omg[j]++;
        }
    int sel;
    for (int i = (1); i <= (n); i++) {
      if (!surv[i] || omg[i]) continue;
      sel = i;
      break;
    }
    res += cnt[sel];
    surv[sel] = false;
  }
  printf("%d\n", res);
  return 0;
}
