#include <bits/stdc++.h>
using namespace std;
template <class C>
void mini(C &a4, C b4) {
  a4 = min(a4, b4);
}
template <class C>
void maxi(C &a4, C b4) {
  a4 = max(a4, b4);
}
template <class TH>
void _dbg(const char *sdbg, TH h) {
  cerr << sdbg << "=" << h << "\n";
}
template <class TH, class... TA>
void _dbg(const char *sdbg, TH h, TA... a) {
  while (*sdbg != ',') cerr << *sdbg++;
  cerr << "=" << h << ",";
  _dbg(sdbg + 1, a...);
}
template <class T>
ostream &operator<<(ostream &os, vector<T> V) {
  os << "[";
  for (auto v : V) os << v << ",";
  os << ']';
  return os;
}
template <class L, class R>
ostream &operator<<(ostream &os, pair<L, R> P) {
  return os << "(" << P.first << ", " << P.second << ")";
}
const long long MaxN = 105;
long long N;
long long points[MaxN], change[MaxN], order[MaxN], curOrder[MaxN];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  if (0) cout << fixed << setprecision(6);
  cin >> N;
  for (long long i = 0; i < N; i++) {
    cin >> points[i] >> change[i];
  }
  iota(order, order + N, 0);
  iota(curOrder, curOrder + N, 0);
  auto rankOrder = [&](long long lhs, long long rhs) {
    return make_pair(-points[lhs], lhs) < make_pair(-points[rhs], rhs);
  };
  sort(order, order + N, [&](long long lhs, long long rhs) {
    if ((change[lhs] > 0) != (change[rhs] > 0)) {
      return (change[rhs] > 0);
    }
    if (change[lhs] > 0) {
      return rankOrder(rhs, lhs);
    } else {
      return rankOrder(lhs, rhs);
    }
  });
  sort(curOrder, curOrder + N, rankOrder);
  long long res = 0;
  for (long long t = 0; t < N; t++) {
    long long who = order[t];
    (who);
    points[who] += change[who];
    long long posFrom = 0, posTo = 0;
    while (curOrder[posFrom] != who) {
      posFrom++;
    }
    sort(curOrder, curOrder + N, rankOrder);
    while (curOrder[posTo] != who) {
      posTo++;
    }
    res += abs(posFrom - posTo);
  }
  cout << res << "\n";
}
