#include <bits/stdc++.h>
using namespace std;
map<int, long long> a, b;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    a[x - y]++;
    b[y + x]++;
  }
  long long sum = 0;
  for (int i = -10000; i <= 100000; i++) {
    sum += a[i] * (a[i] - 1) / 2;
    sum += b[i] * (b[i] - 1) / 2;
  }
  cout << sum << endl;
}
