#include <bits/stdc++.h>
using namespace std;
const int N = 105;
bool t[N];
int ch[N];
int main() {
  int n;
  scanf("%d", &n);
  vector<pair<int, int> > v;
  for (int i = 0, a, b; i < n; i++) {
    scanf("%d%d", &a, &b);
    v.push_back({-a, i});
    ch[i] = b;
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    sort(v.begin(), v.end());
    for (int j = n - 1, in; j >= 0; j--) {
      in = v[j].second;
      if (t[in] || ch[in] < 0) continue;
      v[j].first = -v[j].first + ch[in];
      v[j].first = -v[j].first;
      sort(v.begin(), v.end());
      for (int k = 0; k < n; k++)
        if (v[k].second == in) {
          ans += abs(k - j), t[in] = 1;
          break;
        }
      break;
    }
  }
  for (int i = 0; i < n; i++) {
    sort(v.begin(), v.end());
    for (int j = 0, in; j < n; j++) {
      in = v[j].second;
      if (t[in] || ch[in] >= 0) continue;
      v[j].first = -v[j].first + ch[in];
      v[j].first = -v[j].first;
      sort(v.begin(), v.end());
      for (int k = 0; k < n; k++)
        if (v[k].second == in) {
          ans += abs(k - j), t[in] = 1;
          break;
        }
      break;
    }
  }
  cout << ans << endl;
  return 0;
}
