#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void rread(T& num) {
  num = 0;
  T f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') num = num * 10 + ch - '0', ch = getchar();
  num *= f;
}
const long long inf = 1e16;
const int maxn = 2e2 + 100, mod = 1e9 + 7;
const long double PI = acos(-1.0);
long long gcd(long long a, long long b) { return (a ? gcd(b % a, a) : b); }
void exgcd(long long a, long long b, long long& d, long long& x, long long& y) {
  if (!b) {
    d = a;
    x = 1;
    y = 0;
  } else {
    exgcd(b, a % b, d, y, x);
    y -= x * (a / b);
  }
}
long long power(long long a, long long n) {
  long long p = 1;
  while (n > 0) {
    if (n % 2) {
      p = p * a;
    }
    n >>= 1;
    a *= a;
  }
  return p;
}
long long power(long long a, long long n, long long mod) {
  long long p = 1;
  while (n > 0) {
    if (n % 2) {
      p = p * a;
      p %= mod;
    }
    n >>= 1;
    a *= a;
    a %= mod;
  }
  return p % mod;
}
int n;
pair<int, int> p[maxn], pp;
int flag[maxn], ad[maxn];
int main() {
  while (~scanf("%d", &n)) {
    for (int i = 1; i <= n; i++) {
      int a, d;
      scanf("%d%d", &a, &d);
      p[i].first = a, p[i].second = -i;
      ad[i] = d;
    }
    sort(p + 1, p + 1 + n);
    memset(flag, 0, sizeof flag);
    int ans = 0;
    while (1) {
      int ff = 0;
      for (int i = 1; i <= n; i++) {
        if (flag[-p[i].second] == 0 && ad[-p[i].second] >= 0) {
          flag[-p[i].second] = 1;
          ff = 1;
          p[i].first += ad[-p[i].second];
          pp = p[i];
          sort(p + 1, p + 1 + n);
          for (int j = 1; j <= n; j++)
            if (pp == p[j]) ans += abs(i - j);
          break;
        }
      }
      if (ff == 0) break;
    }
    while (1) {
      int ff = 0;
      for (int i = n; i >= 1; i--) {
        if (flag[-p[i].second] == 0) {
          flag[-p[i].second] = 1;
          ff = 1;
          p[i].first += ad[-p[i].second];
          pp = p[i];
          sort(p + 1, p + 1 + n);
          for (int j = 1; j <= n; j++)
            if (pp == p[j]) ans += abs(i - j);
          break;
        }
      }
      if (ff == 0) break;
    }
    printf("%d\n", ans);
  }
  return 0;
}
