#include <bits/stdc++.h>
using namespace std;
int diags[2000];
int inv_diags[2000];
int main() {
  int n;
  cin >> n;
  for (int(i) = 0; (i) < (int)n; (i)++) {
    int x, y;
    cin >> x >> y;
    diags[1000 - (x - y)]++;
    inv_diags[x + y]++;
  }
  int res = 0;
  for (int(i) = 0; (i) < (int)2000; (i)++) {
    if (diags[i] > 0) res += diags[i] * (diags[i] - 1) / 2;
    if (inv_diags[i] > 0) res += inv_diags[i] * (inv_diags[i] - 1) / 2;
  }
  cout << res << endl;
  return 0;
}
