#include <bits/stdc++.h>
int N, from[100], to[100], BA, p[200], z[4], o[4];
inline bool cmp(int x, int y) {
  return (x < N ? std::make_pair(-from[x], x)
                : std::make_pair(-to[x - N], x - N)) <
         (y < N ? std::make_pair(-from[y], y)
                : std::make_pair(-to[y - N], y - N));
}
inline bool CMP(int x, int y) { return z[x] < z[y]; }
int main() {
  scanf("%d", &N);
  for (int i = 0, x; i < N; i++) {
    scanf("%d%d", from + i, &x);
    to[i] = from[i] + x;
    p[i] = i;
    p[N + i] = N + i;
  }
  std::sort(p, p + N + N, cmp);
  for (int i = 0; i < N + N; i++)
    if (p[i] < N)
      from[p[i]] = i;
    else
      to[p[i] - N] = i;
  for (int i = 0; i < N; i++)
    for (int j = i + 1; j < N; j++) {
      z[0] = from[i], z[1] = to[i], z[2] = from[j], z[3] = to[j];
      o[0] = 0, o[1] = 1, o[2] = 2, o[3] = 3;
      std::sort(o, o + 4, CMP);
      if (o[0] + o[1] == 1 || o[0] + o[1] == 5)
        BA += 0;
      else if ((o[0] + o[2] == 1 || o[0] + o[2] == 5) &&
               ((from[i] < to[i]) == (from[j] < to[j])))
        BA += 2;
      else
        BA += 1;
    }
  printf("%d\n", BA);
  return 0;
}
