#include <bits/stdc++.h>
using namespace std;
const int N = 2222;
long long d[N], d2[N], res, t, t2, x, y, n;
int main() {
  std::ios::sync_with_stdio(0);
  cin.tie(0);
  for (int i = 0; i < N; i++) {
    d[i] = d2[i] = 0;
  }
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x >> y;
    d[x - y + 1010]++;
    d2[x + y]++;
  }
  res = 0;
  for (int i = 0; i < N; i++) {
    t = (d[i] * (d[i] - 1));
    t2 = (d2[i] * (d2[i] - 1));
    res += t + t2;
  }
  res >>= 1;
  cout << res << "\n";
  return 0;
}
