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