#include <bits/stdc++.h>
using namespace std;
int n;
struct node {
  int x, y;
  int id;
} a[1005];
bool operator<(node a, node b) {
  if (a.x != b.x) return a.x > b.x;
  return a.id < b.id;
}
bool operator>(node a, node b) {
  if (a.x != b.x) return a.x < b.x;
  return a.id > b.id;
}
int cal(node a, node b) {
  node c = a, d = b;
  c.x += a.y;
  d.x += d.y;
  if (a < b && c > d) return 1;
  if (a > b && c < d) return 1;
  if (a < b && b < c && d > c) return 2;
  if (a > b && c < b && d < c) return 2;
  if (a < b && d < a && c < d) return 2;
  if (a > b && d > a && c > d) return 2;
  return 0;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", &a[i].x, &a[i].y), a[i].id = i;
  sort(a + 1, a + n + 1);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      ans += cal(a[i], a[j]);
    }
  }
  printf("%d\n", ans);
  return 0;
}
