#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  long long int ans = 0;
  map<long long int, long long int> m1;
  map<long long int, long long int> m2;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    m1[x + y]++;
    m2[x - y]++;
  }
  for (auto i : m1) {
    ans += (i.second * (i.second - 1)) / 2;
  }
  for (auto i : m2) {
    ans += (i.second * (i.second - 1)) / 2;
  }
  cout << ans << "\n";
  return 0;
}
