#include <bits/stdc++.h>
using namespace std;
long long n, i, j, x, y, t, ans = 0;
vector<long long> b1(200001, 2002), b2(200001, 2002);
int main() {
  scanf("%I64d", &n);
  for (i = 0; i < n; ++i) {
    scanf("%I64d%I64d", &x, &y);
    b1[i] = -x - y;
    b2[i] = x - y;
  }
  sort(b1.begin(), b1.end());
  sort(b2.begin(), b2.end());
  for (i = 0; i < n - 1; ++i) {
    t = b1[i];
    for (j = i + 1; j < n && b1[j] == t; ++j) {
    }
    ans += (j - i - 1) * (j - i) / 2;
    i = j - 1;
  }
  for (i = 0; i < n - 1; ++i) {
    t = b2[i];
    for (j = i + 1; j < n && b2[j] == t; ++j) {
    }
    ans += (j - i - 1) * (j - i) / 2;
    i = j - 1;
  }
  printf("%I64d", ans);
  return 0;
}
