#include <bits/stdc++.h>
using namespace std;
const int DELIM = 3000;
int Diag1[DELIM << 1];
int Diag2[DELIM << 1];
int N;
long long Sol;
int main() {
  cin >> N;
  for (int i = 1, x, y; i <= N; ++i) {
    cin >> x >> y;
    Diag1[x - y + DELIM]++;
    Diag2[x + y]++;
  }
  for (int i = 0; i < (DELIM << 1); ++i) {
    if (Diag1[i]) Sol += ((Diag1[i] * (Diag1[i] - 1)) / 2);
    if (Diag2[i]) Sol += ((Diag2[i] * (Diag2[i] - 1)) / 2);
  }
  cout << Sol;
}
