#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int X[n], Y[n];
  ;
  for (long long int i = 0; i < n; i++) cin >> X[i] >> Y[i];
  long long int A[n];
  ;
  for (long long int i = 0; i < n; i++) {
    A[i] = X[i] - Y[i];
  }
  sort(A, A + n);
  long long int count = 1, ans = 0;
  ;
  for (long long int i = 0; i < n - 1; i++) {
    if (A[i] == A[i + 1])
      count++;
    else {
      if (count > 1) {
        ans += (count * (count - 1)) / 2;
      }
      count = 1;
    }
  }
  ans += (count * (count - 1)) / 2;
  long long int B[n];
  ;
  for (long long int i = 0; i < n; i++) B[i] = X[i] + Y[i];
  sort(B, B + n);
  count = 1;
  ;
  for (long long int i = 0; i < n - 1; i++) {
    if (B[i] == B[i + 1])
      count++;
    else {
      if (count > 1) {
        ans += (count * (count - 1)) / 2;
      }
      count = 1;
    }
  }
  if (count > 1) ans += (count * (count - 1)) / 2;
  cout << ans << endl;
}
