#include <bits/stdc++.h>
using namespace std;
int right_diagonal[2004];
int left_diagonal[2004];
int main() {
  long n;
  cin >> n;
  int in1, in2;
  for (long i = 0; i < n; i++) {
    cin >> in1 >> in2;
    right_diagonal[in2 - in1 + 999]++;
    left_diagonal[in1 + in2]++;
  }
  long long ans = 0;
  for (int i = 0; i < 2001; i++) {
    if (right_diagonal[i] > 0) {
      ans += ((right_diagonal[i] - 1) * right_diagonal[i]) / 2;
    }
    if (left_diagonal[i] > 0) {
      ans += ((left_diagonal[i] - 1) * left_diagonal[i]) / 2;
    }
  }
  cout << ans;
  return 0;
}
