#include <bits/stdc++.h>
using namespace std;
const int N = 2000001;
vector<long long> d1(N), d2(N);
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n;
  cin >> n;
  long long x, y;
  for (long long i = 0; i < n; i++) {
    cin >> x >> y;
    d1[x + y]++;
    d2[x - y + 1000]++;
  }
  long long sums = 0;
  for (long long i = 0; i <= 2001; i++) {
    sums += 1LL * (d1[i]) * (d1[i] - 1) / 2;
    sums += 1LL * (d2[i]) * (d2[i] - 1) / 2;
  }
  cout << sums << "\n";
}
