#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, ans = 0;
  cin >> n;
  long long int a, b;
  map<long long int, long long int> k, m;
  map<long long int, long long int>::iterator it;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    k[a + b]++;
    m[a - b]++;
  }
  for (it = k.begin(); it != k.end(); it++) {
    a = it->second;
    a = a * (a - 1) / 2;
    ans = ans + a;
  }
  for (it = m.begin(); it != m.end(); it++) {
    a = it->second;
    a = a * (a - 1) / 2;
    ans = ans + a;
  }
  cout << ans << endl;
}
