#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  vector<pair<long long, long long> > v(n);
  for (long long i = 0; i < n; i++) {
    cin >> v[i].first >> v[i].second;
  }
  long long sum = 0;
  for (long long i = 0; i < n; i++) {
    for (long long j = i + 1; j < n; j++) {
      pair<long long, long long> p1 = v[i], p2 = v[j];
      bool flag = true;
      if (p1.first > p2.first || p1.first == p2.first && i < j) {
        swap(p1, p2);
        flag = false;
      }
      vector<pair<long long, pair<long long, long long> > > p(4);
      if (flag) {
        p[0] = {p1.first, {-i, 1}};
        p[1] = {p1.first + p1.second, {-i, 2}};
        p[2] = {p2.first, {-j, 3}};
        p[3] = {p2.first + p2.second, {-j, 4}};
      } else {
        p[0] = {p1.first, {-j, 1}};
        p[1] = {p1.first + p1.second, {-j, 2}};
        p[2] = {p2.first, {-i, 3}};
        p[3] = {p2.first + p2.second, {-i, 4}};
      }
      sort(p.begin(), p.end());
      vector<long long> g(4);
      for (long long h = 0; h < 4; h++) {
        g[h] = p[h].second.second;
      }
      if (g[0] == 1 && g[2] == 2 && g[1] == 3 && g[3] == 4 ||
          g[0] == 2 && g[2] == 1 && g[3] == 3 && g[1] == 4)
        sum += 2;
      else if (g[0] == 1 && g[3] == 2 || g[1] == 2 && g[2] == 1 ||
               g[1] == 1 && g[2] == 2 ||
               g[1] == 1 && g[2] == 3 && g[3] == 2 && g[0] == 4 ||
               g[0] == 1 && g[2] == 2 && g[3] == 3 && g[1] == 4)
        sum++;
    }
  }
  cout << sum;
}
