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