#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:128000000")
using namespace std;
void solve();
void precalc();
int TESTNUM = 0;
int main() {
  string s = "";
  cin.tie(0);
  cout.sync_with_stdio(0);
  cout.precision(10);
  cout << fixed;
  precalc();
  int t = 1;
  while (t--) {
    ++TESTNUM;
    solve();
  }
  return 0;
}
template <typename T>
T binpow(T q, T w, T mod) {
  if (!w) return 1 % mod;
  if (w & 1) return q * 1LL * binpow(q, w - 1, mod) % mod;
  return binpow(q * 1LL * q % mod, w / 2, mod);
}
void precalc() {}
template <typename T>
T gcd(T q, T w) {
  while (w) {
    q %= w;
    swap(q, w);
  }
  return q;
}
template <typename T>
T lcm(T q, T w) {
  return q / gcd(q, w) * w;
}
inline int nxt() {
  int x;
  cin >> x;
  return x;
}
vector<int> start, finish;
int start_before(int q, int w) {
  int first = (start[q] < start[w]);
  if (start[q] == start[w]) {
    first = q > w;
  }
  return first;
}
int finish_before(int q, int w) {
  int first = (finish[q] < finish[w]);
  if (finish[q] == finish[w]) {
    first = q > w;
  }
  return first;
}
void solve() {
  int n;
  cin >> n;
  start.resize(n);
  finish.resize(n);
  vector<int> d(n);
  for (int i = 0; i < n; ++i) {
    cin >> start[i] >> d[i];
    finish[i] = start[i] + d[i];
  }
  int res = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (start_before(i, j) && finish_before(j, i)) {
        ++res;
      }
    }
  }
  for (int w = 0; w < 2; ++w) {
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < n; ++j) {
        if (start_before(i, j) && finish_before(i, j) && d[i] > 0 && d[j] > 0) {
          if (finish[i] > start[j] || finish[i] == start[j] && i < j) {
            res += 2;
          }
        }
      }
    }
    for (int i = 0; i < n; ++i) {
      start[i] = -start[i];
      finish[i] = -finish[i];
      d[i] = -d[i];
    }
    reverse(start.begin(), start.end());
    reverse(d.begin(), d.end());
    reverse(finish.begin(), finish.end());
  }
  cout << res << "\n";
}
