#include <bits/stdc++.h>
using namespace std;
const int Max = 1e5 + 100;
struct node {
  int x, y, id;
  bool operator<(const node &s) const { return x == s.x ? id < s.id : x > s.x; }
} data[Max];
bool vis[Max];
int main() {
  int n, ans = 0;
  scanf("%d", &n);
  for (int a = 0; a < n; a++)
    scanf("%d%d", &data[a].x, &data[a].y), data[a].id = a;
  sort(data, data + n);
  while (true) {
    bool flag = false;
    int id = 0, fir = 0;
    for (int a = n - 1; a >= 0; a--) {
      if (!vis[data[a].id] && data[a].y >= 0) {
        data[a].x += data[a].y;
        id = data[a].id;
        fir = a;
        vis[data[a].id] = 1;
        flag = true;
        break;
      }
    }
    if (!flag) break;
    sort(data, data + n);
    for (int a = 0; a < n; a++) {
      if (data[a].id == id) {
        ans += fir - a;
        break;
      }
    }
  }
  while (true) {
    bool flag = false;
    int id = 0, fir = 0;
    for (int a = 0; a < n; a++) {
      if (!vis[data[a].id] && data[a].y <= 0) {
        data[a].x += data[a].y;
        vis[data[a].id] = true;
        id = data[a].id;
        fir = a;
        flag = true;
        break;
      }
    }
    if (!flag) break;
    sort(data, data + n);
    for (int a = 0; a < n; a++) {
      if (data[a].id == id) {
        ans += a - fir;
        break;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
