#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  map<long long, long long> vertical;
  map<long long, long long> horizontal;
  for (int i = 0; i < N; ++i) {
    int x, y;
    cin >> x >> y;
    vertical[x + y]++;
    horizontal[x - y]++;
  }
  long long ans = 0;
  for (auto const &p : vertical) {
    if (p.second <= 1) continue;
    long long n = p.second;
    ans += n * (n - 1) / 2;
  }
  for (auto const &p : horizontal) {
    if (p.second <= 1) continue;
    long long n = p.second;
    ans += n * (n - 1) / 2;
  }
  cout << ans << endl;
}
