#include <bits/stdc++.h>
using namespace std;
int n, i, j;
int l[2015] = {0}, r[2015] = {0};
long long ans;
const int MID = 1005;
int main() {
  scanf("%d", &n);
  ans = 0;
  while (n--) {
    scanf("%d%d", &i, &j);
    ++l[i + j];
    ++r[i - j + MID];
  }
  for (i = 0; i < 2015; ++i) {
    if (l[i] > 1) ans += l[i] * (l[i] - 1) / 2;
    if (r[i] > 1) ans += r[i] * (r[i] - 1) / 2;
  }
  printf("%I64d\n", ans);
  return 0;
}
