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