#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int a, b;
  int s[4010];
  cin >> n;
  memset(s, 0, sizeof(s));
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    s[a + b]++;
    s[a - b + 3000]++;
  }
  long long sum = 0;
  for (int i = 0; i <= 4000; i++) {
    if (s[i] > 1) sum += (s[i] * (s[i] - 1) / 2);
  }
  cout << sum << endl;
  return 0;
}
