#include <bits/stdc++.h>
using namespace std;
int ans;
int a[110];
int d[110];
int n;
const int inf = 1e6;
struct data {
  int point;
  int idx;
  int frez;
  data() {}
  data(int point, int idx, int frez) {
    this->point = point;
    this->idx = idx;
    this->frez = frez;
  }
  bool operator<(data x) const {
    if (point == x.point) {
      return idx < x.idx;
    } else
      return point > x.point;
  }
};
data arr[105];
void up() {
  int idx = 0;
  int last = inf;
  for (int i = 1; i <= n; i++) {
    if (arr[i].frez == true) continue;
    int ix = arr[i].idx;
    if (d[ix] <= 0) continue;
    if (a[ix] + d[ix] < last) {
      last = a[ix] + d[ix];
      idx = ix;
    } else if (a[ix] + d[ix] == last) {
      idx = max(idx, ix);
    }
  }
  if (idx == 0) return;
  int pos = 0;
  for (int i = 1; i <= n; i++) {
    if (arr[i].idx == idx) {
      pos = i;
      break;
    }
  }
  arr[pos].point += d[idx];
  arr[pos].frez = true;
  sort(arr + 1, arr + n + 1);
  int new_pos = 0;
  for (int i = 1; i <= n; i++) {
    if (arr[i].idx == idx) {
      new_pos = i;
      break;
    }
  }
  ans += abs(pos - new_pos);
  up();
  return;
}
void down() {
  int first = -inf;
  int idx = 0;
  for (int i = 1; i <= n; i++) {
    int ix = arr[i].idx;
    if (arr[i].frez == true) continue;
    if (d[ix] >= 0) continue;
    if (a[ix] + d[ix] > first) {
      first = a[ix] + d[ix];
      idx = ix;
    } else if (a[ix] + d[ix] == first) {
      idx = min(idx, ix);
    }
  }
  if (idx == 0) return;
  int pos = 0;
  for (int i = 1; i <= n; i++) {
    if (arr[i].idx == idx) {
      pos = i;
      break;
    }
  }
  arr[pos].point += d[idx];
  arr[pos].frez = true;
  sort(arr + 1, arr + n + 1);
  int new_pos = 0;
  for (int i = 1; i <= n; i++) {
    if (arr[i].idx == idx) {
      new_pos = i;
      break;
    }
  }
  ans += abs(pos - new_pos);
  down();
  return;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", a + i, d + i);
  }
  for (int i = 1; i <= n; i++) {
    arr[i].point = a[i];
    arr[i].idx = i;
    arr[i].frez = false;
  }
  sort(arr + 1, arr + n + 1);
  up();
  down();
  printf("%d\n", ans);
}
