#include <bits/stdc++.h>
using namespace std;
const int maxn = 107;
int N, ans = 0;
struct DATA {
  int a, d, id;
  bool v;
  void read(int _id) {
    scanf("%d%d", &a, &d);
    id = _id;
  }
  bool operator<(const DATA &o) const {
    if (a != o.a)
      return a < o.a;
    else
      return id > o.id;
  }
} P[maxn];
int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; ++i) {
    P[i].read(i);
  }
  sort(P + 1, P + N + 1);
  for (int i = 1; i <= N; ++i) {
    bool ok = false;
    for (int j = 1; j <= N; ++j)
      if (P[j].v == false && P[j].d > 0) {
        ok = true;
        P[j].a += P[j].d;
        P[j].v = true;
        while (j <= N - 1 && P[j + 1] < P[j]) swap(P[j], P[j + 1]), ++ans, ++j;
        break;
      }
    if (!ok) break;
  }
  for (int i = N; i; --i) {
    bool ok = false;
    for (int j = N; j; --j)
      if (P[j].v == false && P[j].d < 0) {
        ok = true;
        P[j].a += P[j].d;
        P[j].v = true;
        while (j > 1 && P[j] < P[j - 1]) swap(P[j], P[j - 1]), ++ans, --j;
        break;
      }
    if (!ok) break;
  }
  cout << ans << endl;
}
