#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a;
  cin >> n;
  map<int, int> add;
  map<int, int> sub;
  int x, y, num;
  long long int cnt = 0;
  for (a = 0; a < n; a++) {
    cin >> x >> y;
    add[x + y]++;
    sub[x - y]++;
    if (add[x + y] > 1) {
      cnt = cnt + add[x + y] - 1;
    }
    if (sub[x - y] > 1) {
      cnt = cnt + sub[x - y] - 1;
    }
  }
  cout << cnt;
}
