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