#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const double PI = acos(-1.);
const double eps = 1e-10;
const int INF = 0x3f3f3f3f;
const long long INFLL = 0x3f3f3f3f3f3f3f3f;
const int MAXN = 1e6 + 5;
int a[MAXN], d[MAXN];
pair<int, int> gra[MAXN], gra2[MAXN];
vector<int> G[MAXN];
int in[MAXN];
int n;
void top_sort() {
  vector<int> p;
  queue<int> q;
  for (int i = 1; i <= n; i++)
    if (!in[i]) q.push(i);
  while (!q.empty()) {
    int now = q.front();
    q.pop();
    p.push_back(now);
    for (int i : G[now])
      if (!--in[i]) q.push(i);
  }
  set<pair<int, int> > s;
  for (int i = 1; i <= n; i++) s.insert(gra[i]);
  int ans = 0;
  for (int i : p) {
    int lower = 0, sm = 0;
    for (pair<int, int> t : s)
      if (t < gra[i]) lower++;
    s.erase(gra[i]);
    s.insert(gra2[i]);
    for (pair<int, int> t : s)
      if (t < gra2[i]) sm++;
    ans += abs(sm - lower);
  }
  printf("%d\n", ans);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", &a[i], &d[i]);
    gra[i] = make_pair(a[i], -i);
    gra2[i] = make_pair(a[i] + d[i], -i);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (gra[i] < gra[j] && gra2[i] > gra[j] && gra2[i] < gra2[j])
        G[i].push_back(j), in[j]++;
      if (gra[i] > gra[j] && gra2[i] < gra[j] && gra2[i] > gra2[j])
        G[i].push_back(j), in[j]++;
    }
  }
  top_sort();
  return 0;
}
