#include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 28;
const long long INF = 1LL << 60;
template <class T>
inline void Rd(T &res) {
  res = 0;
  char c;
  while (c = getchar(), !isdigit(c))
    ;
  do res = (res << 1) + (res << 3) + (c ^ 48);
  while (c = getchar(), isdigit(c));
}
template <class T>
void put(T x) {
  if (x == 0) return;
  put(x / 10);
  putchar(x % 10 ^ 48);
}
template <class T>
inline void print(T x) {
  if (x == 0) {
    putchar(48);
    return;
  } else if (x < 0)
    putchar('-'), x = -x;
  put(x);
}
template <class T1, class T2>
inline void Max(T1 &x, const T2 &k) {
  if (x < k) x = k;
}
template <class T1, class T2>
inline void Min(T1 &x, const T2 &k) {
  if (x > k) x = k;
}
const int M = 255;
const int base = 105;
struct node {
  int L, R;
} A[M];
int v[M][M];
int main() {
  int n;
  cin >> n;
  for (int i = 1, x, y; i <= n; ++i) {
    scanf("%d%d", &x, &y);
    y += x;
    A[i].L = x, A[i].R = y;
  }
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      int a = A[i].L, c = A[i].R;
      int b = A[j].L, d = A[j].R;
      if ((a < b && b <= c) || (c < b && b <= a)) v[i][j]++;
      if ((b <= c && c < d) || (d <= c && c < b)) v[i][j]++;
      if ((a < d && d <= c) || (c < d && d <= a)) v[j][i]++;
      if ((b <= a && a < d) || (d <= a && a < b)) v[j][i]++;
      ans += max(v[i][j], v[j][i]);
    }
  }
  cout << ans << endl;
  return 0;
}
