#include <bits/stdc++.h>
using namespace std;
int n, coloana, linie, poz, sum;
int diag_princip[2 * 1005], diag_sec[2 * 1005];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> coloana >> linie;
    diag_princip[coloana - linie + 1000]++;
    diag_sec[coloana + linie]++;
  }
  for (int i = 1; i <= 2000; i++) {
    sum += diag_princip[i] * (diag_princip[i] - 1) / 2;
    sum += diag_sec[i] * (diag_sec[i] - 1) / 2;
  }
  cout << sum << '\n';
  return 0;
}
