#include <bits/stdc++.h>
using namespace std;
const int N = 1 << 7;
pair<int, int> a[N], b[N];
vector<int> g[N];
int n, x, y, res, sum;
bool Inside(pair<int, int> x, pair<int, int> l, pair<int, int> r) {
  if (l > r) swap(l, r);
  return l < x && x < r;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++)
    scanf("%d%d", &x, &y), a[i] = pair<int, int>(x, -i),
                           b[i] = pair<int, int>(x + y, -i);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) {
      int cur = Inside(a[j], a[i], b[i]) + Inside(b[i], a[j], b[j]);
      if (cur == 2)
        res += cur;
      else
        sum += cur;
    }
  cout << res + sum / 2 << endl;
}
