#include <bits/stdc++.h>
using namespace std;
map<long long, long long> add;
map<long long, long long> sub;
int main() {
  long long n, x, y, maxa = 0, maxs = 0, mina = 999999999999999,
                     mins = 999999999999999, c = 0;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> x >> y;
    if (x + y > maxa) maxa = x + y;
    if (x + y < mina) mina = x + y;
    if (x - y > maxs) maxs = x - y;
    if (x - y < mins) mins = x - y;
    add[x + y]++;
    sub[x - y]++;
  }
  for (long long i = mina; i <= maxa; i++) {
    if (add[i] > 1) c += (add[i] * (add[i] - 1)) / 2;
  }
  for (long long i = mins; i <= maxs; i++) {
    if (sub[i] > 1) c += (sub[i] * (sub[i] - 1)) / 2;
  }
  cout << c << endl;
  return 0;
}
