#include <bits/stdc++.h>
using namespace std;
int n;
int a[300], b[300];
int dp[300][300];
int cur[300];
vector<int> vl, vr;
int getrank(int k) {
  int res = 0;
  for (int i = 1; i <= n; i++)
    if (make_pair(cur[k], -k) <= make_pair(cur[i], -i)) res++;
  return res;
}
int go(int l, int r) {
  if (l == int((vl).size()) and r == int((vr).size())) return 0;
  if (dp[l][r] != -1) return dp[l][r];
  int maks = 0;
  for (int i = 0; i <= int((vl).size()) - 1; i++)
    if (i >= l)
      cur[vl[i]] = a[vl[i]];
    else
      cur[vl[i]] = a[vl[i]] + b[vl[i]];
  for (int i = 0; i <= int((vr).size()) - 1; i++)
    if (i >= r)
      cur[vr[i]] = a[vr[i]];
    else
      cur[vr[i]] = a[vr[i]] + b[vr[i]];
  int rankL2 = -1, rankR2 = -1, rankL1 = -1, rankR1 = -1;
  if (l < int((vl).size())) {
    rankL1 = getrank(vl[l]);
    cur[vl[l]] = a[vl[l]] + b[vl[l]];
    rankL2 = getrank(vl[l]);
    cur[vl[l]] = a[vl[l]];
    maks = max(maks, abs(rankL2 - rankL1) + go(l + 1, r));
  }
  if (r < int((vr).size())) {
    rankR1 = getrank(vr[r]);
    cur[vr[r]] = a[vr[r]] + b[vr[r]];
    rankR2 = getrank(vr[r]);
    cur[vr[r]] = a[vr[r]];
    maks = max(maks, abs(rankR2 - rankR1) + go(l, r + 1));
  }
  return dp[l][r] = maks;
}
bool compL(int l, int r) { return make_pair(a[l], -l) > make_pair(a[r], -r); }
bool compR(int l, int r) { return make_pair(a[l], -l) < make_pair(a[r], -r); }
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i];
    if (b[i] < 0)
      vl.push_back(i);
    else
      vr.push_back(i);
  }
  sort((vl).begin(), (vl).end(), compL);
  sort((vr).begin(), (vr).end(), compR);
  memset(dp, -1, sizeof(dp));
  cout << go(0, 0) << "\n";
}
