#include <bits/stdc++.h>
using namespace std;
long long nC2(long long n) {
  long long k = n * (n - 1);
  return k / 2;
}
void solve() {
  long long n;
  cin >> n;
  map<long long, long long> m1, m2;
  for (long long i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    m1[a - b]++;
    m2[b + a]++;
  }
  long long ans = 0;
  for (auto i : m1) {
    ans += nC2(i.second);
  }
  for (auto i : m2) {
    ans += nC2(i.second);
  }
  cout << ans << endl;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  { solve(); }
  return 0;
}
