#include <bits/stdc++.h>
using namespace std;
bool f;
long long maxx = -999999999999, minn = 999999999999;
string toBin(int n) {
  string s;
  while (n) {
    s = (n % 2 == 0 ? "0" : "1") + s;
    n /= 2;
  }
  while (s.length() != 8) s = "0" + s;
  return s;
}
int toDec(string s, int base) { return strtoull(s.c_str(), NULL, base); }
map<long long, long long> le, ri;
long long cal(int a) { return (a * (a - 1)) / 2; }
int main() {
  int n, i;
  cin >> n;
  for (i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    ri[a + b]++;
    le[a - b]++;
  }
  map<long long, long long>::iterator it = le.begin();
  map<long long, long long>::iterator it1 = ri.begin();
  long long k = 0, k1 = 0;
  while (it != le.end()) {
    if (it->second > 1) k += cal(it->second);
    ++it;
  }
  while (it1 != ri.end()) {
    if (it1->second > 1) k1 += cal(it1->second);
    ++it1;
  }
  cout << k + k1;
  return 0;
}
