#include <bits/stdc++.h>
using namespace std;
void mohammed() {
  ios::sync_with_stdio(0);
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
}
long long ncr(long long n, long long r) {
  if (r == 0)
    return 1;
  else {
    long long num = n * ncr(n - 1, r - 1);
    return num / r;
  }
}
int main() {
  mohammed();
  int n, x, y;
  map<int, int> mp, m;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    mp[x + y]++;
    m[x - y]++;
  }
  long long ans = 0;
  for (map<int, int>::iterator it = mp.begin(); it != mp.end(); it++) {
    if (it->second > 1) ans += ncr(it->second, 2LL);
  }
  for (map<int, int>::iterator it = m.begin(); it != m.end(); it++) {
    if (it->second > 1) ans += ncr(it->second, 2LL);
  }
  cout << ans;
  return 0;
}
