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