#include <bits/stdc++.h>
using namespace std;
struct team {
  int pointsBefore;
  int delta;
  int index;
  int postOrder;
};
struct score {
  int points;
  int index;
};
int n;
team* teams;
score before(const team& a) {
  score s;
  s.points = a.pointsBefore;
  s.index = a.index;
  return s;
}
score after(const team& a) {
  score s;
  s.points = a.pointsBefore + a.delta;
  s.index = a.index;
  return s;
}
bool operator<(const score& a, const score& b) {
  return a.points > b.points || a.points == b.points && a.index < b.index;
}
int swaps(const team& a, const team& b) {
  return ((before(a) < before(b)) != (after(a) < before(b))) +
         ((after(a) < before(b)) != (after(a) < after(b)));
}
bool ls(const team& a, const team& b) { return swaps(a, b) > swaps(b, a); }
void swap(team* teams, int i, int j) {
  team t = teams[j];
  teams[j] = teams[i];
  teams[i] = t;
}
int postOrder = 0;
void dfs(int v) {
  teams[v].postOrder = -1;
  for (int i = 0; i < n; i++)
    if (teams[i].postOrder == 0)
      if (ls(teams[v], teams[i])) dfs(i);
  teams[v].postOrder = ++postOrder;
}
int main(void) {
  cin >> n;
  teams = new team[n];
  for (int i = 0; i < n; i++) {
    cin >> teams[i].pointsBefore >> teams[i].delta;
    teams[i].index = i + 1;
    teams[i].postOrder = 0;
  }
  for (int i = 0; i < n; i++)
    if (teams[i].postOrder == 0) dfs(i);
  sort(teams, teams + n,
       [](const team& a, const team& b) { return a.postOrder < b.postOrder; });
  reverse(teams, teams + n);
  int* order = new int[n];
  for (int i = 0; i < n; i++) order[i] = teams[i].index;
  sort(teams, teams + n,
       [](const team& a, const team& b) { return before(a) < before(b); });
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int j = 0;
    for (; teams[j].index != order[i]; j++)
      ;
    teams[j].pointsBefore += teams[j].delta;
    while (true) {
      if (j > 0 && before(teams[j]) < before(teams[j - 1]))
        swap(teams, j, j - 1), j--, ans++;
      else if (j < n - 1 && before(teams[j + 1]) < before(teams[j]))
        swap(teams, j, j + 1), j++, ans++;
      else
        break;
    }
  }
  cout << ans;
  return 0;
}
