#include <bits/stdc++.h>
using namespace std;
int main() {
  int res = 0;
  map<int, int> udiag;
  map<int, int> ldiag;
  int n, x, y;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    udiag[x + y]++;
    ldiag[x - y]++;
  }
  map<int, int>::iterator itr;
  for (itr = udiag.begin(); itr != udiag.end(); itr++) {
    res += itr->second * (itr->second - 1) / 2;
  }
  cout << endl;
  for (itr = ldiag.begin(); itr != ldiag.end(); itr++) {
    res += itr->second * (itr->second - 1) / 2;
  }
  cout << res << endl;
}
