#include <bits/stdc++.h>
using namespace std;
int n;
int init[101];
int initRank[101];
int diff[101];
int final[101];
int finalRank[101];
vector<int> adj[101];
vector<bool> visited;
vector<int> topo_order;
void dfs(int v) {
  visited[v] = true;
  for (int u : adj[v]) {
    if (!visited[u]) dfs(u);
  }
  topo_order.push_back(v);
}
void topological_sort() {
  visited.assign(n, false);
  topo_order.clear();
  for (int i = 0; i < n; ++i) {
    if (!visited[i]) dfs(i);
  }
  reverse(topo_order.begin(), topo_order.end());
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  vector<pair<int, int> > initOrder;
  vector<pair<int, int> > finalOrder;
  for (int i = 0; i < n; i++) {
    cin >> init[i];
    cin >> diff[i];
    final[i] = init[i] + diff[i];
    initOrder.push_back({-init[i], i});
    finalOrder.push_back({-final[i], i});
  }
  sort(initOrder.begin(), initOrder.end());
  sort(finalOrder.begin(), finalOrder.end());
  for (int i = 0; i < n; i++) {
    initRank[initOrder[i].second] = i;
    finalRank[finalOrder[i].second] = i;
  }
  int ansz = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i == j) continue;
      if (initRank[i] < initRank[j]) {
        if (finalRank[i] < finalRank[j] &&
            (final[i] < init[j] || (final[i] == init[j] && i > j) ||
             final[j] > init[i] || (final[j] == init[i] && (j < i)))) {
          adj[j].push_back(i);
          ansz += 2;
        } else if (finalRank[i] > finalRank[j]) {
          ansz++;
        }
      }
    }
  }
  int ans = 0;
  cout << ansz << endl;
  return 0;
  topological_sort();
  int currscore[n];
  for (int i = 0; i < n; i++) {
    currscore[i] = init[i];
  }
  vector<int> order;
  for (int i = 0; i < n; i++) {
    order.push_back(initOrder[i].second);
  }
  for (int i = 0; i < n; i++) {
    int toProcess = topo_order[i];
    auto currPointer = find(order.begin(), order.end(), toProcess);
    int currRank = currPointer - order.begin();
    order.erase(currPointer);
    int j = 0;
    while (j < n - 1 &&
           (currscore[order[j]] > final[toProcess] ||
            (currscore[order[j]] == final[toProcess] && j < toProcess))) {
      j++;
    }
    order.insert(order.begin() + j, toProcess);
    ans += abs(j - currRank);
    currscore[toProcess] = final[toProcess];
  }
  cout << ans << endl;
}
