#include <bits/stdc++.h>
using namespace std;
int n, a[110], d[110], ans;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", &a[i], &d[i]);
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if ((a[i] < a[j]) ^ (a[i] + d[i] < a[j] + d[j]))
        ans++;
      else {
        int l1 = min(a[i], a[i] + d[i]), r1 = max(a[i], a[i] + d[i]);
        int l2 = min(a[j], a[j] + d[j]), r2 = max(a[j], a[j] + d[j]);
        if (r1 < l2 || r2 <= l1)
          ;
        else
          ans += 2;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
