#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-8;
const int mod = 1e9 + 7;
const int N = 1e6 + 10;
const long long INF = 1e18;
long long power(long long x, long long y) {
  long long t = 1;
  while (y > 0) {
    if (y % 2)
      y -= 1, t = t * x % mod;
    else
      y /= 2, x = x * x % mod;
  }
  return t;
}
pair<int, int> ak[N];
pair<pair<int, int>, int> arr[N];
int main() {
  int n;
  scanf("%d", &n);
  int l = 0;
  for (int i = 0; i < n; ++i) {
    int a, d;
    scanf("%d%d", &a, &d);
    arr[l++] = make_pair(make_pair(-a, i), -1);
    arr[l++] = make_pair(make_pair(-a - d, i), 1);
  }
  sort(arr, arr + l);
  for (int i = 0; i < l; ++i) {
    if (arr[i].second == -1)
      ak[arr[i].first.second].first = i;
    else
      ak[arr[i].first.second].second = i;
  }
  int ans = 0;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j)
      if (i < j) {
        int p = 1;
        pair<int, int> x = ak[i], y = ak[j];
        if (x.first < y.first && y.first < x.second && x.second < y.second) p++;
        if (x.first > y.first && y.first > x.second && x.second > y.second) p++;
        swap(x, y);
        if (x.first < y.first && y.first < x.second && x.second < y.second) p++;
        if (x.first > y.first && y.first > x.second && x.second > y.second) p++;
        if (x.first > x.second) swap(x.first, x.second);
        if (y.first > y.second) swap(y.first, y.second);
        if (i < j) {
          if (x.second < y.first) p--;
          if (y.second < x.first) p--;
        }
        ans += p;
      }
  printf("%d\n", ans);
  return 0;
}
