#include <bits/stdc++.h>
using namespace std;
long long ans, n, i, x[200010], y[200010], a[5000], b[5000];
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) cin >> x[i] >> y[i];
  for (i = 1; i <= n; i++) a[x[i] - y[i] + 1000]++;
  for (i = 1; i <= n; i++) b[x[i] + y[i]]++;
  for (i = 1; i <= 2016; i++)
    ans += ((a[i] - 1) * a[i] + (b[i] - 1) * b[i]) / 2;
  cout << ans << endl;
  return 0;
}
