#include <bits/stdc++.h>
using namespace std;
long long n, ans = 0;
long long a[3000], b[3000];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (long long i = 0, tmp1, tmp2; i < n; ++i) {
    cin >> tmp1 >> tmp2;
    a[tmp1 + tmp2] += 1;
    b[1000 + tmp1 - tmp2] += 1;
  }
  for (long long i = 0; i < 3000; ++i) {
    if (a[i] > 0) ans += (a[i] - 1) * a[i] / 2;
    if (b[i] > 0) ans += (b[i] - 1) * b[i] / 2;
  }
  cout << ans;
}
