#include <bits/stdc++.h>
const double eps = 1e-6;
using namespace std;
int a[1005];
bool sorted(pair<int, int> p1, pair<int, int> p2) {
  return p1.first == p2.first ? p1.second < p2.second : p1.first > p2.first;
}
int main() {
  int n;
  scanf("%d", &n);
  vector<pair<int, int> > ve;
  int res = 0;
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d%d", &x, &a[i]);
    ve.push_back({x, i});
  }
  sort(ve.begin(), ve.end(), sorted);
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      pair<int, int> p1 = ve[i], p2 = ve[j];
      p1.first += a[ve[i].second];
      p2.first += a[ve[j].second];
      if (!sorted(p1, p2)) {
        res++;
        continue;
      }
      if (sorted(ve[j], p1) || sorted(p2, ve[i])) res += 2;
    }
  }
  printf("%d\n", res);
  return 0;
}
