#include <bits/stdc++.h>
using namespace std;
map<long long, long long> t1;
map<long long, long long> t2;
const int MAXI = 5000;
int main() {
  long long n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long x, y;
    cin >> x >> y;
    t1[x + y]++;
    t2[x - y]++;
  }
  long long ans = 0;
  for (long long i = -MAXI; i <= MAXI; i++) {
    if (t1[i] > 1) {
      long long temp = 1;
      if (t1[i] % 2 == 0)
        temp = t1[i] / 2 * (t1[i] - 1);
      else
        temp = (t1[i] - 1) / 2 * t1[i];
      ans += temp;
    }
  }
  for (long long i = -MAXI; i <= MAXI; i++) {
    if (t2[i] > 1) {
      long long temp = 1;
      if (t2[i] % 2 == 0)
        temp = t2[i] / 2 * (t2[i] - 1);
      else
        temp = (t2[i] - 1) / 2 * t2[i];
      ans += temp;
    }
  }
  cout << ans << endl;
  return 0;
}
