#include <bits/stdc++.h>
using namespace std;
struct Team {
  int p1, p2, num;
  bool operator<(const Team &x) const {
    if (p1 == x.p1)
      return num < x.num;
    else
      return p1 > x.p1;
  }
} t[105];
int main() {
  int n, i, j, ans = 0, k;
  cin >> n;
  for (i = 1; i <= n; i++) {
    scanf("%d%d", &t[i].p1, &t[i].p2);
    t[i].num = i;
  }
  sort(t + 1, t + 1 + n);
  for (k = 1; k <= n; k++) {
    for (i = 1; i <= n; i++)
      if (t[i].p2 < 0) {
        t[i].p1 += t[i].p2;
        t[i].p2 = 0;
        for (j = i + 1; j <= n; j++)
          if (t[j] < t[j - 1]) {
            ans++;
            swap(t[j], t[j - 1]);
          }
        break;
      }
  }
  for (k = 1; k <= n; k++) {
    for (i = n; i; i--)
      if (t[i].p2 > 0) {
        t[i].p1 += t[i].p2;
        t[i].p2 = 0;
        for (j = i; j > 1; j--)
          if (t[j] < t[j - 1]) {
            ans++;
            swap(t[j], t[j - 1]);
          }
        break;
      }
  }
  cout << ans << endl;
  return 0;
}
