#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T sqr(T x) {
  return x * x;
}
int a[2500];
int b[2500];
int main() {
  int n;
  while (~scanf("%d", &n)) {
    memset(a, 0, sizeof(a));
    memset(b, 0, sizeof(b));
    for (int i = 0; i < n; i++) {
      int x, y;
      scanf("%d%d", &x, &y);
      a[y - x + 1000]++;
      b[y + x]++;
    }
    int ans = 0;
    for (int i = 0; i <= 2000; i++) {
      ans += a[i] * (a[i] - 1) / 2;
      ans += b[i] * (b[i] - 1) / 2;
    }
    printf("%d\n", ans);
  }
  return 0;
}
