#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2 * 1000 * 100;
int Minus[MAXN], Plus[MAXN];
int main() {
  int n, x, y, X = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    Minus[x - y + 2100]++;
    Plus[x + y + 2100]++;
  }
  for (int i = 0; i < 5000; i++) {
    if (Minus[i] != 0) {
      X += (Minus[i] * (Minus[i] - 1)) / 2;
    }
    if (Plus[i] != 0) {
      X += (Plus[i] * (Plus[i] - 1)) / 2;
    }
  }
  cout << X;
}
