#include <bits/stdc++.h>
using namespace std;
vector<int> A, B;
int solve(int u, int v) {
  if (pair<long, long>{A[u], -u} > pair<long, long>{A[v], -v}) {
    int t = u;
    u = v;
    v = t;
  }
  if (pair<long, long>{B[u], -u} < pair<long, long>{B[v], -v}) {
    if (pair<long, long>{B[v], -v} < pair<long, long>{A[u], -u} ||
        pair<long, long>{B[u], -u} > pair<long, long>{A[v], -v})
      return 2;
    return 0;
  }
  return 1;
}
int main() {
  int n;
  cin >> n;
  A.resize(n, 0);
  B.resize(n, 0);
  for (int i = 0; i < n; i++) {
    cin >> A[i] >> B[i];
    B[i] += A[i];
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      ans += solve(i, j);
    }
  }
  cout << ans << endl;
}
