#include <bits/stdc++.h>
using namespace std;
struct node {
  int a, d, id;
  bool b;
  friend bool operator<(node x, node y) {
    if (x.a > y.a) return 1;
    if (x.a < y.a) return 0;
    if (x.id < y.id) return 1;
    return 0;
  }
} a[110];
int n, ans;
bool bo;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &a[i].a, &a[i].d);
    a[i].id = i;
  }
  sort(a + 1, a + n + 1);
  while (1) {
    bo = 0;
    int i = n;
    while (i >= 1) {
      if (a[i].b == 0 && a[i].d >= 0) {
        bo = 1;
        break;
      }
      i--;
    }
    if (bo == 0) break;
    a[i].a += a[i].d;
    a[i].b = 1;
    while (i > 1) {
      if (a[i] < a[i - 1])
        swap(a[i], a[i - 1]), ans++;
      else
        break;
      i--;
    }
  }
  while (1) {
    bo = 0;
    int i = 1;
    while (i <= n) {
      if (a[i].b == 0 && a[i].d < 0) {
        bo = 1;
        break;
      }
      i++;
    }
    if (bo == 0) break;
    a[i].a += a[i].d;
    a[i].b = 1;
    while (i < n) {
      if (a[i + 1] < a[i])
        swap(a[i + 1], a[i]), ans++;
      else
        break;
      i++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
