#include <bits/stdc++.h>
using namespace std;
int n;
int s[101], d[501];
int main(void) {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &s[i], &d[i]);
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      int a = s[i] * 100 + 99 - i;
      int b = s[i] * 100 + d[i] * 100 + 99 - i;
      if (a > b) swap(a, b);
      b++;
      int l = s[j] * 100 + 99 - j;
      int r = s[j] * 100 + d[j] * 100 + 99 - j;
      if (l > r) swap(l, r);
      r++;
      if (b <= l || r <= a) {
      } else if (a <= l && r <= b) {
        ans++;
      } else if (l <= a && b <= r) {
        ans++;
      } else {
        if (d[i] * d[j] <= 0) {
          ans++;
        } else {
          ans += 2;
        }
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
