#include <bits/stdc++.h>
int sum[10000] = {0}, dp[10000] = {0}, dn[10000] = {0};
int main() {
  int n, i, s, p, dif, x, y;
  long long ans = 0;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d%d", &x, &y);
    s = x + y;
    sum[s]++;
    if (x >= y) {
      p = x - y;
      dp[p]++;
    } else {
      dif = y - x;
      dn[dif]++;
    }
  }
  for (i = 0; i <= 2004; i++) {
    ans += (long long)(sum[i] * (sum[i] - 1)) / 2;
    ans += (long long)(dp[i] * (dp[i] - 1)) / 2;
    ans += (long long)(dn[i] * (dn[i] - 1)) / 2;
  }
  printf("%I64d\n", ans);
  return 0;
}
