#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int N;
  long long int diag[200001][2];
  long long int x, y;
  pair<long long int, long long int> bishop[200001];
  cin >> N;
  long long int i;
  for (i = 0; i < N; i++) {
    cin >> bishop[i].first >> bishop[i].second;
    diag[bishop[i].second - bishop[i].first + 1000][0]++;
    diag[bishop[i].second + bishop[i].first][1]++;
  }
  long long int ans = 0;
  for (i = 0; i < N; i++) {
    ans += diag[bishop[i].second + bishop[i].first][1] +
           diag[bishop[i].second - bishop[i].first + 1000][0] - 2;
  }
  cout << ans / 2 << endl;
  return 0;
}
