#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> sumy(2001, 0), roznice(2001, 0);
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    sumy[a + b] += 1;
    roznice[1000 + a - b] += 1;
  }
  long long result = 0;
  for (int i = 0; i <= 2000; i++) {
    result += sumy[i] * (sumy[i] - 1) / 2;
    result += roznice[i] * (roznice[i] - 1) / 2;
  }
  cout << result;
}
