#include <bits/stdc++.h>
using namespace std;
const int max_n = 20010;
int lf[max_n];
int rf[max_n];
int main() {
  long long sum = 0;
  int n;
  int x, y;
  memset(lf, 0, sizeof(lf));
  memset(rf, 0, sizeof(rf));
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d%d", &x, &y);
    ++lf[y - x + 1000];
    ++rf[x + y];
  }
  for (int i = 0; i <= 2050; ++i) {
    sum += (lf[i] * (lf[i] - 1)) / 2;
  }
  for (int i = 0; i <= 2050; ++i) {
    sum += (rf[i] * (rf[i] - 1)) / 2;
  }
  printf("%I64d\n", sum);
  return 0;
}
