#include <bits/stdc++.h>
using namespace std;
long long pwr(long long base, long long p, long long mod = (1000000007LL)) {
  long long ans = 1;
  while (p) {
    if (p & 1) ans = (ans * base) % mod;
    base = (base * base) % mod;
    p /= 2;
  }
  return ans;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int n, BIT[1000005];
vector<int> inc_[1000005], dec_[1000005];
void update(int idx, int val) {
  while (idx <= 1000000) {
    BIT[idx] += val;
    idx += idx & (-idx);
  }
}
int query(int idx) {
  int ans = 0;
  while (idx) {
    ans += BIT[idx];
    idx -= idx & (-idx);
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = n - 1; i >= 0; i--) {
    int a, d;
    cin >> a >> d;
    a += 100;
    if (d >= 0) {
      inc_[100 * a + i].push_back(100 * d);
    } else {
      dec_[100 * a + i].push_back(100 * d);
    }
  }
  int ans = 0;
  memset(BIT, 0, sizeof(BIT));
  for (int i = 1; i <= 1000000; i++)
    update(i, (int)inc_[i].size() + (int)dec_[i].size());
  for (int i = 1; i <= 1000000; i++) {
    for (auto j : inc_[i]) {
      int newval = i + j;
      ans += query(newval) - query(i);
      update(i, -1);
      update(newval, 1);
    }
  }
  for (int i = 100000; i >= 1; i--) {
    for (auto j : dec_[i]) {
      int newval = i + j;
      ans += query(i - 1) - query(newval);
      update(i, -1);
      update(newval, 1);
    }
  }
  cout << ans;
  return 0;
}
