#include <bits/stdc++.h>
using namespace std;
typedef pair<long long, long long> ll;
typedef vector<long long> vl;
typedef vector<ll> vll;
void solve() {
  long long n;
  cin >> n;
  map<long long, long long> m;
  vector<pair<long long, long long> > v;
  for (long long i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    v.push_back(make_pair(a, b));
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    m[v[i].first - v[i].second]++;
  }
  for (map<long long, long long>::iterator it = m.begin(); it != m.end();
       it++) {
    long long k = it->second;
    ans += (k * (k - 1)) / 2;
  }
  m.clear();
  for (int i = 0; i < n; i++) {
    m[v[i].first + v[i].second]++;
  }
  for (map<long long, long long>::iterator it = m.begin(); it != m.end();
       it++) {
    long long k = it->second;
    ans += (k * (k - 1)) / 2;
  }
  cout << ans;
}
int main() {
  ll t;
  solve();
}
