#include <bits/stdc++.h>
using namespace std;
map<long long, long long> mp;
map<long long, long long> pm;
int main() {
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    long long x, y;
    cin >> x >> y;
    mp[x + y]++;
    pm[x - y]++;
  }
  long long sum = 0;
  for (long long i = -2000; i <= 2000; i++) {
    if (mp[i]) sum += ((mp[i] * (mp[i] - 1)) / 2);
    if (pm[i]) sum += ((pm[i] * (pm[i] - 1)) / 2);
  }
  cout << sum << endl;
  return 0;
}
