#include <bits/stdc++.h>
using namespace std;
template <typename T>
T getint() {
  T x = 0, p = 1;
  char ch;
  do {
    ch = getchar();
  } while (ch <= ' ');
  if (ch == '-') p = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * p;
}
template <typename T1, typename T2>
bool umin(T1 &x, const T2 &y) {
  if (x > y) return x = y, true;
  return false;
}
template <typename T1, typename T2>
bool umax(T1 &x, const T2 &y) {
  if (x < y) return x = y, true;
  return false;
}
const int maxn = 5e3 + 10;
const int inf = (int)1e9 + 5;
const int mod = (int)1e9 + 7;
const long long llinf = (long long)1e18 + 5;
const long double pi = acos(-1.0);
int n;
int a[maxn];
int d[maxn];
int order[maxn];
int main() {
  srand(time(NULL));
  cin >> n;
  for (int i = (0); i < (n); i++) cin >> a[i] >> d[i], order[i] = i;
  sort(order, order + n, [&](int i, int j) {
    if (d[i] >= 0 && d[j] <= 0) return true;
    if (d[i] <= 0 && d[j] >= 0) return false;
    if (d[i] >= 0) return a[i] < a[j] || (a[i] == a[j] && i > j);
    return a[i] > a[j] || (a[i] == a[j] && i < j);
  });
  int res = 0;
  vector<pair<int, int> > z(n);
  for (int i = (0); i < (n); i++) z[i] = make_pair(a[i], -i);
  sort((z).begin(), (z).end());
  reverse((z).begin(), (z).end());
  for (int i = (0); i < (n); i++) {
    int j = order[i];
    int x = -1;
    for (int c = (0); c < (n); c++)
      if (z[c].second == -j) x = c;
    z[x].first += d[j];
    sort((z).begin(), (z).end());
    reverse((z).begin(), (z).end());
    int y = -1;
    for (int c = (0); c < (n); c++)
      if (z[c].second == -j) y = c;
    res += abs(x - y);
  }
  cout << res << endl;
  return 0;
}
