#include <bits/stdc++.h>
using namespace std;
bool fun(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
  if (a.first.first < b.first.first) return true;
  if (a.first.first > b.first.first) return false;
  return a.second > b.second;
}
int main() {
  int n;
  cin >> n;
  vector<pair<pair<int, int>, int> > v(n);
  for (int i = 0; i < n; ++i) {
    cin >> v[i].first.first >> v[i].first.second;
    v[i].second = i;
  }
  sort(v.begin(), v.end(), fun);
  vector<int> cre, de;
  for (int i = 0; i < n; ++i) {
    if (v[i].first.second > 0)
      cre.push_back(v[i].second);
    else
      de.push_back(v[i].second);
  }
  int res = 0;
  for (int i = 0; i < cre.size(); ++i) {
    int k;
    for (int j = 0; j < n; ++j) {
      if (v[j].second == cre[i]) k = j;
    }
    pair<pair<int, int>, int> mou = pair<pair<int, int>, int>(
        pair<int, int>(v[k].first.first + v[k].first.second, 0), v[k].second);
    ++k;
    while (k < v.size() and fun(v[k], mou)) {
      v[k - 1] = v[k];
      ++res;
      ++k;
    }
    v[k - 1] = mou;
  }
  for (int i = de.size() - 1; i >= 0; --i) {
    int k;
    for (int j = 0; j < n; ++j) {
      if (v[j].second == de[i]) k = j;
    }
    pair<pair<int, int>, int> mou = pair<pair<int, int>, int>(
        pair<int, int>(v[k].first.first + v[k].first.second, 0), v[k].second);
    --k;
    while (k < v.size() and not fun(v[k], mou)) {
      v[k + 1] = v[k];
      ++res;
      --k;
    }
    v[k + 1] = mou;
  }
  cout << res << '\n';
}
