#include <bits/stdc++.h>
using namespace std;
int main() {
  double a;
  long long n, c = 0;
  long long i;
  cin >> n;
  long A[n][2];
  long x, y;
  long X[1000], X2[1000];
  long Y[2001];
  for (i = 0; i < 1000; i++) {
    X[i] = 0;
    X2[i] = 0;
  }
  for (i = 0; i < 2001; i++) Y[i] = 0;
  for (i = 0; i < n; i++) {
    cin >> A[i][0] >> A[i][1];
    x = A[i][0];
    y = A[i][1];
    if (x >= y) {
      X[x - y]++;
    } else {
      X2[y - x]++;
    }
    Y[x + y]++;
  }
  for (i = 0; i < 1000; i++) {
    c = c + (X[i] * (X[i] - 1)) / 2;
    c = c + (X2[i] * (X2[i] - 1)) / 2;
  }
  for (i = 0; i < 2001; i++) {
    c = c + (Y[i] * (Y[i] - 1)) / 2;
  }
  cout << c;
  return 0;
}
