#include <bits/stdc++.h>
using namespace std;
int aa[2222], bb[2222], cc[2222];
int xx(int x) {
  if (x == 0 || x == 1)
    return 0;
  else {
    int y = 0;
    for (int i = 1; i < x; i++) {
      y += i;
    }
    return y;
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    if (a - b >= 0)
      aa[a - b]++;
    else
      cc[b - a]++;
    bb[a + b]++;
  }
  int x = 0;
  for (int i = 0; i < 2222; i++) {
    x += xx(aa[i]);
  }
  for (int i = 0; i < 2222; i++) {
    x += xx(bb[i]);
  }
  for (int i = 0; i < 2222; i++) {
    x += xx(cc[i]);
  }
  cout << x << endl;
}
