#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, y;
  scanf("%d", &n);
  int mal[2005], del[2005];
  memset(mal, 0, sizeof(mal));
  memset(del, 0, sizeof(del));
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &x, &y);
    del[x - y + 1000]++;
    mal[x + y]++;
  }
  int sum = 0;
  for (int i = 1; i <= 2000; i++) {
    if (mal[i] > 1) sum += mal[i] * (mal[i] - 1) / 2;
    if (del[i] > 1) sum += del[i] * (del[i] - 1) / 2;
  }
  printf("%d\n", sum);
  return 0;
}
