#include <bits/stdc++.h>
using namespace std;
pair<int, int> arr[200010];
int a[200010], b[200010];
int main() {
  int n;
  while (cin >> n) {
    memset(a, 0, sizeof(a));
    memset(b, 0, sizeof(b));
    for (int i = 0; i < n; i++) {
      cin >> arr[i].first >> arr[i].second;
      a[arr[i].first + arr[i].second]++;
      b[arr[i].first - arr[i].second + 2001]++;
    }
    long long ans = 0;
    for (int i = 0; i < 200010; i++) {
      ans += 1LL * a[i] * (a[i] - 1) / 2;
      ans += 1LL * b[i] * (b[i] - 1) / 2;
    }
    cout << ans << endl;
  }
  return 0;
}
