#include <bits/stdc++.h>
using namespace std;
int n, ck[105];
struct info {
  int point, change, id;
  info() {}
  info(int a, int b, int c) { point = a, change = b, id = c; }
};
bool cmp(info a, info b) {
  if (a.point != b.point) return a.point > b.point;
  return a.id < b.id;
}
vector<info> v;
int main() {
  scanf("%d", &n);
  v.resize(n + 1);
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &v[i].point, &v[i].change);
    v[i].id = i;
  }
  sort(v.begin(), v.begin() + n, cmp);
  v[n].point = -1e9;
  ck[n] = 1;
  v[n].id = n;
  int ans = 0;
  while (1) {
    int ite = -1;
    for (int i = (int)v.size() - 1; i >= 0; i--) {
      if (ck[v[i].id] == 0 && v[i].change >= 0) {
        ck[v[i].id] = 1;
        v[i].point += v[i].change;
        ite = i;
        break;
      }
    }
    if (ite == -1) break;
    info now = v[ite];
    v.erase(v.begin() + ite);
    if (now.point > v[0].point ||
        now.point == v[0].point && now.id <= v[0].id) {
      v.insert(v.begin(), now);
      ans += ite;
    } else {
      for (int i = 0; i < v.size() - 1; i++) {
        int c1 = 0;
        int c2 = 0;
        if (v[i].point > now.point ||
            v[i].point == now.point && v[i].id < now.id)
          c1 = 1;
        if (now.point > v[i + 1].point ||
            now.point == v[i + 1].point && now.id < v[i + 1].id)
          c2 = 1;
        if (c1 == 1 && c2 == 1) {
          ans += ite - i - 1;
          v.insert(v.begin() + i + 1, now);
          break;
        }
      }
    }
  }
  while (1) {
    int ite = -1;
    for (int i = 0; i < v.size(); i++) {
      if (ck[v[i].id] == 0 && v[i].change < 0) {
        ck[v[i].id] = 1;
        v[i].point += v[i].change;
        ite = i;
        break;
      }
    }
    if (ite == -1) break;
    info now = v[ite];
    v.erase(v.begin() + ite);
    if (now.point > v[0].point ||
        now.point == v[0].point && now.id <= v[0].id) {
      v.insert(v.begin(), now);
      ans += ite;
    } else {
      for (int i = 0; i < v.size() - 1; i++) {
        int c1 = 0;
        int c2 = 0;
        if (v[i].point > now.point ||
            v[i].point == now.point && v[i].id < now.id)
          c1 = 1;
        if (now.point > v[i + 1].point ||
            now.point == v[i + 1].point && now.id < v[i + 1].id)
          c2 = 1;
        if (c1 == 1 && c2 == 1) {
          ans += abs(ite - (i + 1));
          v.insert(v.begin() + i + 1, now);
          break;
        }
      }
    }
  }
  printf("%d", ans);
}
