#include <bits/stdc++.h>
using namespace std;
const long long oo = 1e9;
const long long EPS = 1e-9;
const long long mod = 1e9 + 7;
const long long mod2 = (mod - 1);
int a[1009] = {0}, b[1009] = {0}, d[2009] = {0};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, m;
  cin >> n;
  int x, y;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    if (y >= x)
      ++b[y - x];
    else
      ++a[x - y];
    ++d[x + y];
  }
  long long sum = 0;
  for (int i = 0; i < 1001; i++) {
    if (a[i] != 0) sum += (a[i] * (a[i] - 1) / 2);
    if (b[i] != 0) sum += (b[i] * (b[i] - 1) / 2);
  }
  for (int i = 1; i <= 2001; i++) {
    if (d[i] != 0) sum += (d[i] * (d[i] - 1) / 2);
  }
  cout << sum << endl;
}
