#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  map<int, int> mp1, mp2;
  while (n--) {
    int x, y;
    cin >> x >> y;
    mp1[x + y]++;
    mp2[x - y]++;
  }
  long long int ans = 0;
  for (auto x : mp1) {
    ans += (x.second * (x.second - 1) / 2);
  }
  for (auto x : mp2) {
    ans += (x.second * (x.second - 1) / 2);
  }
  cout << ans << endl;
  return 0;
}
