#include <bits/stdc++.h>
using namespace std;
bool a[1010][1010];
int main() {
  long long n, x, y, ans = 0, one = 1, two = 2;
  cin >> n;
  while (n--) {
    cin >> x >> y;
    a[x][y] = true;
  }
  cout << endl;
  for (long long x = 1; x <= 1000; x++) {
    long long c = 0;
    for (long long i = x, j = 1; i <= 1000 && j <= 1000; i++, j++) {
      c += a[i][j];
    }
    ans += (((c * (c - one)) / two));
  }
  for (long long y = 2; y <= 1000; y++) {
    long long c = 0;
    for (long long i = 1, j = y; i <= 1000 && j <= 1000; i++, j++) {
      c += a[i][j];
    }
    ans += (((c * (c - one)) / two));
  }
  for (long long x = 1; x <= 1000; x++) {
    long long c = 0;
    for (long long i = x, j = 1000; i <= 1000 && j > 0; i++, j--) {
      c += a[i][j];
    }
    ans += (((c * (c - one)) / two));
  }
  for (long long y = 999; y > 0; y--) {
    long long c = 0;
    for (long long i = 1, j = y; i <= 1000 && j > 0; i++, j--) {
      c += a[i][j];
    }
    ans += (((c * (c - one)) / two));
  }
  cout << ans;
  return 0;
}
