#include <bits/stdc++.h>
using namespace std;
const int Maxn = 100;
struct Team {
  int id;
  int rank;
  int score;
  int edit;
  int preEdit;
  int preScore;
};
Team team[Maxn + 5];
int n;
inline bool cmp(Team a, Team b) {
  if (a.score != b.score) return a.score > b.score;
  return a.id < b.id;
}
inline void initRank() {
  sort(team + 1, team + n + 1, cmp);
  for (int i = 1; i <= n; i++) {
    team[i].rank = i;
    team[i].preEdit = team[i].edit;
    team[i].preScore = team[i].score;
  }
}
inline void editTeam(int x) {
  team[x].score += team[x].edit;
  team[x].edit = 0;
  sort(team + 1, team + n + 1, cmp);
}
inline void recTeam() {
  for (int i = 1; i <= n; i++) {
    team[i].score = team[i].preScore;
    team[i].edit = team[i].preEdit;
  }
  sort(team + 1, team + n + 1, cmp);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", &team[i].score, &team[i].edit);
  for (int i = 1; i <= n; i++) team[i].id = i;
  int Ans = 0;
  int Flag = 0;
  for (int Rt = 1; Flag != 3; Rt++) {
    if (Rt % 2) {
      int index = -1;
      initRank();
      for (int i = 1; i <= n; i++)
        if (team[i].edit < 0) {
          index = i;
          break;
        }
      editTeam(index);
      for (int i = 1; i <= n; i++)
        if (team[i].rank == index) Ans += abs(team[i].rank - i);
      if (index == -1) Flag |= 1;
    } else {
      int index = -1;
      initRank();
      for (int i = n; i >= 1; i--)
        if (team[i].edit > 0) {
          index = i;
          break;
        }
      editTeam(index);
      for (int i = 1; i <= n; i++)
        if (team[i].rank == index) Ans += abs(team[i].rank - i);
      if (index == -1) Flag |= 2;
    }
  }
  printf("%d\n", Ans);
  return 0;
}
