#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  map<int, int> da, db;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    da[a + b]++;
    db[a - b]++;
  }
  long long cnt = 0;
  for (auto& kv : da) {
    cnt += kv.second * (kv.second - 1) / 2;
  }
  for (auto& kv : db) {
    cnt += kv.second * (kv.second - 1) / 2;
  }
  cout << cnt << endl;
  return 0;
}
