#include <bits/stdc++.h>
using namespace std;
const int N = 111;
const long long INF = 1e9 + 19;
struct Per {
  int a, id, d;
};
int n;
Per per[N];
bool cmp(pair<int, int> A, pair<int, int> B) {
  return A.first > B.first || (A.first == B.first && A.second < B.second);
}
void read() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &per[i].a);
    scanf("%d", &per[i].d);
    per[i].id = i;
  }
  for (int i = 0; i < n; i++)
    sort(per, per + n, [](Per A, Per B) {
      return cmp(make_pair(A.a, A.id), make_pair(B.a, B.id));
    });
  int answer = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      auto ri = make_pair(per[i].a + per[i].d, per[i].id);
      auto rj = make_pair(per[j].a + per[j].d, per[j].id);
      auto bi = make_pair(per[i].a, per[i].id);
      auto bj = make_pair(per[j].a, per[j].id);
      if (cmp(rj, ri)) {
        answer++;
      } else {
        if (cmp(rj, bi)) answer += 2;
        if (cmp(bj, ri)) answer += 2;
      }
    }
  }
  cout << answer << endl;
}
void solve() {}
void stress() {}
int main() {
  if (1) {
    int k = 1;
    for (int tt = 0; tt < k; tt++) {
      read();
      solve();
    }
  } else {
    stress();
  }
  return 0;
}
