#include <bits/stdc++.h>
using namespace std;
const int N = 105;
pair<int, int> bef[N], af[N];
int inside(int x, pair<int, int> c) {
  pair<int, int> a = bef[x], b = af[x];
  if (a > b) swap(a, b);
  return a < c && c < b;
}
int main() {
  int a, b, id, n, i, k, u;
  cin >> n;
  for (i = 0; i < n; ++i)
    scanf("%d%d", &a, &b), bef[i] = make_pair(a, -i),
                           af[i] = make_pair(a + b, -i);
  int r1 = 0, r2 = 0;
  for (i = 0; i < n; ++i)
    for (k = 0; k < n; ++k) {
      if (inside(i, bef[k]) && inside(i, af[k])) {
        ++r1;
      } else if ((inside(i, bef[k]) && inside(k, bef[i]))) {
        ++r2;
      } else if ((inside(i, bef[k]) && inside(k, af[i])) ||
                 (inside(i, af[k]) && inside(k, bef[i])))
        ++r1;
      else if (inside(i, af[k]) && inside(k, af[i]))
        ++r2;
    }
  cout << r1 + r2 / 2 << endl;
}
