#include <bits/stdc++.h>
using namespace std;
int n;
pair<int, int> moves[100];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    moves[i] = {a, b};
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      pair<int, int> mem[4];
      mem[0] = {moves[i].first, 1};
      mem[1] = {moves[i].first + moves[i].second, 1};
      mem[2] = {moves[j].first, 0};
      mem[3] = {moves[j].first + moves[j].second, 0};
      sort(mem, mem + 4);
      int a = 0;
      for (int i = 0; i < 4; i++) {
        a <<= 1;
        a += mem[i].second;
      }
      if (a == 12 || a == 3) {
      } else if (a == 6 || a == 9) {
        ans++;
      } else {
        ans += 1 + ((moves[i].second > 0) == (moves[j].second > 0));
      }
    }
  }
  printf("%d\n", ans);
}
