#include <bits/stdc++.h>
using namespace std;
struct Team {
  int point, diff, id;
};
vector<Team> up, down;
vector<pair<int, int> > now;
int main() {
  int N;
  cin >> N;
  now.resize(N + 1);
  for (int i = 1, p, d; i <= N; i++) {
    cin >> p >> d;
    if (d >= 0)
      up.push_back({p, d, i});
    else
      down.push_back({p, d, i});
    now[i] = {p, -i};
  }
  sort(up.begin(), up.end(), [&](const Team& a, const Team& b) {
    if (a.point == b.point) return a.id > b.id;
    return a.point < b.point;
  });
  sort(down.begin(), down.end(), [&](const Team& a, const Team& b) {
    if (a.point == b.point) return a.id < b.id;
    return a.point > b.point;
  });
  int ans = 0;
  for (int i = 0; i < up.size(); i++) {
    int id = up[i].id;
    int x = 0;
    for (int j = 1; j <= N; j++) {
      if (now[id] <= now[j]) x++;
    }
    now[id].first += up[i].diff;
    int y = 0;
    for (int j = 1; j <= N; j++) {
      if (now[id] <= now[j]) y++;
    }
    ans += abs(x - y);
  }
  for (int i = 0; i < down.size(); i++) {
    int id = down[i].id;
    int x = 0;
    for (int j = 1; j <= N; j++) {
      if (now[id] <= now[j]) x++;
    }
    now[id].first += down[i].diff;
    int y = 0;
    for (int j = 1; j <= N; j++) {
      if (now[id] <= now[j]) y++;
    }
    ans += abs(x - y);
  }
  cout << ans;
  return 0;
}
