#include <bits/stdc++.h>
using namespace std;
int n;
int choose2(int n) { return (n * (n - 1)) / 2; }
int find_b_pos(int x, int y) { return y - x; }
int find_b_neg(int x, int y) { return y + x; }
int main() {
  cin >> n;
  map<int, int> mpos;
  map<int, int> mneg;
  int x, y;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    bool found = false;
    mpos[y - x]++;
    mneg[y + x]++;
  }
  long count = 0;
  for (auto it = mpos.begin(); it != mpos.end(); it++) {
    count += choose2(it->second);
  }
  for (auto it = mneg.begin(); it != mneg.end(); it++) {
    count += choose2(it->second);
  }
  cout << count << endl;
}
