#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
long long POW(long long a, long long b, long long MMM = MOD) {
  long long ret = 1;
  for (; b; b >>= 1, a = (a * a) % MMM)
    if (b & 1) ret = (ret * a) % MMM;
  return ret;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) {
  if (a == 0 || b == 0) return a + b;
  return a * (b / gcd(a, b));
}
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, 1, -1};
vector<int> v[101];
int a[101], b[101], ind[101], n;
pair<int, int> rev1[101], rev2[101];
int res(int x, int y) {
  int c = 0;
  if (rev1[x] < rev1[y]) {
    if (rev2[x] < rev1[y]) {
      if (rev2[x] > rev2[y]) c++;
    } else {
      c++;
      if (rev2[x] < rev2[y]) c++;
    }
  } else {
    if (rev2[x] > rev1[y]) {
      if (rev2[x] < rev2[y]) c++;
    } else {
      c++;
      if (rev2[x] > rev2[y]) c++;
    }
  }
  return c;
}
vector<int> vv;
pair<int, int> cur[101];
int main() {
  scanf("%d", &n);
  for (int(i) = (1); (i) <= (n); (i) += (1)) {
    scanf("%d%d", a + i, b + i);
    b[i] += a[i];
    rev1[i] = make_pair(-a[i], i);
    rev2[i] = make_pair(-b[i], i);
  }
  for (int(i) = (1); (i) <= (n); (i) += (1))
    for (int(j) = (i + 1); (j) <= (n); (j) += (1)) {
      int t1 = res(i, j), t2 = res(j, i);
      if (t1 > t2)
        v[i].push_back(j), ind[j]++;
      else if (t1 < t2)
        v[j].push_back(i), ind[i]++;
    }
  queue<int> q;
  for (int(i) = (1); (i) <= (n); (i) += (1))
    if (!ind[i]) q.push(i);
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    vv.push_back(x);
    for (int next : v[x]) {
      ind[next]--;
      if (!ind[next]) q.push(next);
    }
  }
  for (int(i) = (1); (i) <= (n); (i) += (1)) cur[i] = rev1[i];
  sort(cur + 1, cur + n + 1);
  int ans = 0;
  for (int(ii) = (0); (ii) <= (n - 1); (ii) += (1)) {
    int des = vv[ii];
    int t1, t2;
    for (int(i) = (1); (i) <= (n); (i) += (1)) {
      if (cur[i].second == des) {
        t1 = i;
        cur[i] = rev2[des];
        break;
      }
    }
    sort(cur + 1, cur + n + 1);
    for (int(i) = (1); (i) <= (n); (i) += (1)) {
      if (cur[i].second == des) {
        t2 = i;
        break;
      }
    }
    ans += abs(t1 - t2);
  }
  printf("%d", ans);
}
