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