#include <bits/stdc++.h>
using namespace std;
const int maxn = 1010;
int n, z[maxn][2], s[maxn], y[maxn];
bool done[maxn];
bool cmp(int a, int b) {
  if (s[a] != s[b])
    return s[a] > s[b];
  else
    return a < b;
}
int main() {
  scanf("%d", &n);
  for (int a = 1; a <= n; a++) {
    scanf("%d%d", &z[a][0], &z[a][1]);
  }
  for (int a = 1; a <= n; a++) y[a] = a;
  for (int a = 1; a <= n; a++) s[a] = z[a][0];
  sort(y + 1, y + n + 1, cmp);
  int ans = 0;
  for (int a = n; a >= 1; a--) {
    int now = y[a];
    if (done[now]) continue;
    if (z[now][1] > 0) {
      done[now] = true;
      s[now] += z[now][1];
      int p = a;
      while (p > 1 && (s[now] > s[y[p - 1]] ||
                       (s[now] == s[y[p - 1]] && now < y[p - 1]))) {
        swap(y[p], y[p - 1]);
        p--;
        ans++;
      }
      a++;
    }
  }
  for (int a = 1; a <= n; a++) {
    int now = y[a];
    if (done[now]) continue;
    if (z[now][1] < 0) {
      done[now] = true;
      s[now] += z[now][1];
      int p = a;
      while (p < n && (s[now] < s[y[p + 1]] ||
                       (s[now] == s[y[p + 1]] && now > y[p + 1]))) {
        swap(y[p], y[p + 1]);
        p++;
        ans++;
      }
      a--;
    }
  }
  printf("%d\n", ans);
  return 0;
}
