#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const int MOD = 1e9 + 7;
const long long llinf = 1ll * inf * inf;
const double eps = 1e-12;
struct T {
  int a, d, index;
  bool operator<(const T& o) const {
    return make_pair(-a, index) < make_pair(-o.a, o.index);
  }
};
vector<T> a;
int apply(const vector<int>& ind, vector<T> a) {
  sort(a.begin(), a.end());
  int ret = 0;
  for (int idx : ind) {
    int x = -1;
    for (int i = 0; i < int(int((a).size())); ++i)
      if (a[i].index == idx) {
        x = i;
        break;
      }
    assert(x != -1);
    a[x].a += a[x].d;
    sort(a.begin(), a.end());
    int y = -1;
    for (int i = 0; i < int(int((a).size())); ++i)
      if (a[i].index == idx) {
        y = i;
        break;
      }
    assert(y != -1);
    ret += abs(x - y);
  }
  return ret;
}
int cmp(int i, int j) {
  return make_pair(-apply({i, j}, {a[i], a[j]}), i) <
         make_pair(-apply({j, i}, {a[i], a[j]}), j);
}
vector<vector<int>> adj;
int vis[123];
vector<int> Stack;
void dfs(int u) {
  if (vis[u]) return;
  vis[u] = 1;
  for (int v : adj[u]) dfs(v);
  Stack.push_back(u);
}
int main() {
  int n;
  cin >> n;
  a.resize(n);
  adj.resize(n + 1);
  for (int i = 0; i < int(n); ++i) {
    cin >> a[i].a >> a[i].d;
    a[i].index = i;
  }
  for (int i = 0; i < int(n); ++i)
    for (int j = 0; j < int(n); ++j) {
      if (i != j && apply({i, j}, {a[i], a[j]}) > apply({j, i}, {a[i], a[j]}))
        adj[i].push_back(j);
    }
  for (int i = 0; i < int(n); ++i) adj[n].push_back(i);
  dfs(n);
  Stack.pop_back();
  reverse(Stack.begin(), Stack.end());
  cout << apply(Stack, a) << endl;
  return 0;
}
