#include <bits/stdc++.h>
using namespace std;
set<pair<int, int> > temz;
int mods[200];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d%d", &x, mods + i);
    temz.insert(pair<int, int>(x * n + n - i - 1, 0));
  }
  auto it = temz.begin();
  int res = 0;
  while (it != temz.end()) {
    if (!(it->second)) {
      int id = n - it->first % n - 1;
      if (mods[id] > 0) {
        int val = it->first + mods[id] * n;
        auto it2 = it;
        ++it2;
        while (it2 != temz.end() && it2->first < val) {
          ++res;
          ++it2;
        }
        temz.insert(pair<int, int>(val, 1));
        it2 = it;
        ++it2;
        temz.erase(it);
        it = it2;
      } else {
        ++it;
      }
    } else {
      ++it;
    }
  }
  auto rit = temz.rbegin();
  while (rit != temz.rend()) {
    if (!(rit->second)) {
      int id = n - rit->first % n - 1;
      if (mods[id] < 0) {
        int val = rit->first + mods[id] * n;
        auto it2 = rit;
        ++it2;
        while (it2 != temz.rend() && it2->first > val) {
          ++res;
          ++it2;
        }
        temz.insert(pair<int, int>(val, 1));
      }
    }
    ++rit;
  }
  printf("%d\n", res);
}
