#include <bits/stdc++.h>
using namespace std;
const int N = 7070;
const int inf = 1e9;
int n, a[N], d[N], num[N];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i] >> d[i];
  for (int i = 1; i <= n; i++) num[i] = i;
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++)
      if (a[i] > a[j] || (a[i] == a[j] && num[i] < num[j])) {
        swap(a[i], a[j]);
        swap(d[i], d[j]);
        swap(num[i], num[j]);
      }
  int ans = 0;
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) {
      int ans1 = ans;
      if (d[i] >= 0 && d[j] >= 0) {
        if (a[i] + d[i] > a[j] || (a[i] + d[i] == a[j] && num[i] < num[j])) {
          ans++;
          if (a[j] + d[j] > a[i] + d[i] ||
              (a[j] + d[j] == a[i] + d[i] && num[j] < num[i]))
            ans++;
        }
      } else if (d[i] <= 0 && d[j] <= 0) {
        if (a[j] + d[j] < a[i] || (a[j] + d[j] == a[i] && num[j] > num[i])) {
          ans++;
          if (a[i] + d[i] < a[j] + d[j] ||
              (a[i] + d[i] == a[j] + d[j] && num[i] > num[j]))
            ans++;
        }
      } else if (d[i] >= 0 && d[j] <= 0) {
        if (a[i] + d[i] > a[j] + d[j] ||
            (a[i] + d[i] == a[j] + d[j] && num[i] < num[j]))
          ans++;
      }
    }
  cout << ans;
  return 0;
}
