#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[2002] = {0}, b[2002] = {0};
  int n;
  scanf("%d", &n);
  while (n--) {
    int x, y;
    scanf("%d %d", &x, &y);
    a[x + y]++;
    b[x - y + 1000]++;
  }
  int i;
  long long ans = 0;
  for (i = 0; i < 2002; i++) {
    ans += (a[i] * (a[i] - 1) / 2) + (b[i] * (b[i] - 1)) / 2;
  }
  printf("%lld\n", ans);
  return 0;
}
