#include <bits/stdc++.h>
using namespace std;
constexpr int INF = 0x3f3f3f3f;
mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count());
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  map<int, long long> c1, c2;
  for (int i = 0; i < int(n); ++i) {
    int x, y;
    cin >> x >> y;
    c1[x + y]++;
    c2[x - y]++;
  }
  long long ans = 0;
  for (auto it : c1) ans += it.second * (it.second - 1) / 2;
  for (auto it : c2) ans += it.second * (it.second - 1) / 2;
  cout << ans;
  return 0;
}
