#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-6;
const int MAXN = 1e2 + 5;
int sign(double x) { return x < -EPS ? -1 : x > EPS; }
int dbcmp(double l, double r) { return sign(l - r); }
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
struct Edge {
  int from, to, cost, nxt;
} E[2 * MAXN * MAXN];
int head[MAXN], cntE;
struct XX {
  int point, id;
  bool operator<(const XX& r) const {
    return point == r.point ? id < r.id : point > r.point;
  }
};
struct Node {
  int bef, aft, id;
  int bj(Node& r) {
    XX a = {bef, id};
    int cnt = 0;
    XX b = {r.bef, r.id};
    XX c = {aft, id};
    XX d = {r.aft, r.id};
    cnt += (a < b) != (c < b);
    cnt += (c < b) != (c < d);
    return cnt;
  }
  void print() { printf("...Team %d %d\n", bef, aft); }
} Team[MAXN];
void addE(int a, int b, int c) {
  E[cntE].from = b;
  E[cntE].to = a;
  E[cntE].cost = c;
  E[cntE].nxt = head[a];
  head[a] = cntE++;
}
int main() {
  int n, ans = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &Team[i].bef, &Team[i].aft);
    Team[i].aft += Team[i].bef;
    Team[i].id = i;
    for (int j = 1; j < i; j++) {
      if (Team[i].bj(Team[j]) == 2 || Team[j].bj(Team[i]) == 2) ans += 2;
      if (Team[i].bj(Team[j]) == 1 && Team[j].bj(Team[i]) == 1) ans += 1;
    }
  }
  printf("%d\n", ans);
}
