#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  map<int, int> mp;
  map<int, int> np;
  for (int i = 1; i <= n; i++) {
    int x, y;
    cin >> x >> y;
    int p = y - x;
    int q = y + x;
    mp[p]++;
    np[q]++;
  }
  map<int, int>::iterator it;
  int box = 0;
  for (it = mp.begin(); it != mp.end(); it++) {
    int g = it->second;
    box += (g * (g - 1)) / 2;
  }
  for (it = np.begin(); it != np.end(); it++) {
    int g = it->second;
    box += (g * (g - 1)) / 2;
  }
  cout << box << endl;
}
