#include <bits/stdc++.h>
using namespace std;
int n, x, d;
pair<int, int> v[105];
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> v[i].first >> v[i].second;
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if ((v[i].first < v[j].first) !=
          (v[i].first + v[i].second < v[j].first + v[j].second))
        ans++;
      else {
        int a = min(v[i].first, v[i].first + v[i].second),
            b = max(v[i].first, v[i].first + v[i].second);
        int c = min(v[j].first, v[j].first + v[j].second),
            d = max(v[j].first, v[j].first + v[j].second);
        if (b < c || d <= a)
          ;
        else
          ans += 2;
      }
    }
  }
  cout << ans;
  return 0;
}
