#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  map<int, int> diag1, diag2;
  while (n--) {
    int x, y;
    cin >> x >> y;
    diag1[x + y]++;
    diag2[x - y]++;
  }
  int no_of_pairs = 0;
  for (auto i : diag1) {
    no_of_pairs += ((i.second) * (i.second - 1)) / 2;
  }
  for (auto i : diag2) {
    no_of_pairs += ((i.second) * (i.second - 1)) / 2;
  }
  cout << no_of_pairs;
}
