#include <bits/stdc++.h>
using namespace std;
long long n;
long long a[1010101], b[10101011];
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    long long x, y;
    cin >> x >> y;
    a[x + y]++;
    b[y - x + 10000]++;
  }
  long long ans = 0;
  for (int i = 0; i <= 2000; i++) {
    ans += a[i] * (a[i] - 1) / 2;
  }
  for (int i = 0; i <= 200000; i++) ans += b[i] * (b[i] - 1) / 2;
  cout << ans << endl;
  return 0;
}
