#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void chkmax(T& x, U y) {
  if (x < y) x = y;
}
template <typename T, typename U>
inline void chkmin(T& x, U y) {
  if (y < x) x = y;
}
int a[111], b[111], d[111];
int dp[111][111];
bool cmp(int u, int v) {
  int x = (d[u] < 0), y = (d[v] < 0);
  if (x) {
    if (a[u] != a[v]) return a[u] > a[v];
    return u < v;
  } else {
    if (a[u] != a[v]) return a[u] < a[v];
    return u > v;
  }
}
int n;
vector<int> A, B;
int get(int u) {
  int ret = 1;
  for (int i = 0; i < n; i++) {
    if (b[i] > b[u])
      ret++;
    else if (b[i] == b[u] && i < u)
      ret++;
  }
  return ret;
}
int calc(int la, int lb, int u) {
  for (int k = 0; k < la; k++) b[A[k]] = a[A[k]] + d[A[k]];
  for (int k = la; k < A.size(); k++) b[A[k]] = a[A[k]];
  for (int k = lb; k < B.size(); k++) b[B[k]] = a[B[k]];
  for (int k = 0; k < lb; k++) b[B[k]] = a[B[k]] + d[B[k]];
  int first = get(u);
  b[u] = a[u] + d[u];
  return abs(get(u) - first);
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> d[i];
    if (d[i] < 0) {
      A.push_back(i);
    } else {
      B.push_back(i);
    }
  }
  sort((A).begin(), (A).end(), cmp);
  sort((B).begin(), (B).end(), cmp);
  dp[0][0] = 0;
  for (int i = 0; i <= A.size(); i++) {
    for (int j = 0; j <= B.size(); j++) {
      if (i == 0 && j == 0) continue;
      if (i == 0) {
        dp[i][j] = dp[i][j - 1] + calc(i, j - 1, B[j - 1]);
      } else if (j == 0) {
        dp[i][j] = dp[i - 1][j] + calc(i - 1, j, A[i - 1]);
      } else {
        dp[i][j] = max(dp[i - 1][j] + calc(i - 1, j, A[i - 1]),
                       dp[i][j - 1] + calc(i, j - 1, B[j - 1]));
      }
    }
  }
  printf("%d\n", dp[A.size()][B.size()]);
  return 0;
}
