#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
  cin >> n;
  int x[n + 1], y[n + 1], jml[2010], sel[2010];
  for (int i = 0; i < 2010; i++) {
    jml[i] = 0, sel[i] = 0;
  }
  for (int i = 1; i <= n; i++) {
    cin >> x[i] >> y[i];
    int jumlah = x[i] + y[i];
    int selisih = x[i] - y[i] + 1000;
    jml[jumlah]++;
    sel[selisih]++;
  }
  int ans = 0;
  for (int i = 0; i < 2010; i++) {
    if (jml[i] > 1) {
      ans += (jml[i] * (jml[i] - 1)) / 2;
    }
    if (sel[i] > 1) {
      ans += (sel[i] * (sel[i] - 1)) / 2;
    }
  }
  cout << ans << endl;
}
