#include <bits/stdc++.h>
using namespace std;
int a[105], d[105], n, ans = 0;
bool cmp(pair<int, int> a, pair<int, int> b) {
  if (a.first == b.first) return a.second < b.second;
  return a.first > b.first;
}
int main() {
  scanf("%d\n", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d\n", &a[i], &d[i]);
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++)
      ans += max(
          (cmp(pair<int, int>(a[i], i), pair<int, int>(a[j], j)) ^
           cmp(pair<int, int>(a[i] + d[i], i), pair<int, int>(a[j], j))) +
              (cmp(pair<int, int>(a[i] + d[i], i), pair<int, int>(a[j], j)) ^
               cmp(pair<int, int>(a[i] + d[i], i),
                   pair<int, int>(a[j] + d[j], j))),
          (cmp(pair<int, int>(a[i], i), pair<int, int>(a[j], j)) ^
           cmp(pair<int, int>(a[i], i), pair<int, int>(a[j] + d[j], j))) +
              (cmp(pair<int, int>(a[i], i), pair<int, int>(a[j] + d[j], j)) ^
               cmp(pair<int, int>(a[i] + d[i], i),
                   pair<int, int>(a[j] + d[j], j))));
  printf("%d\n", ans);
}
