#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[2005];
  int b[2005];
  int n;
  int xi, yi;
  long long ans = 0;
  cin >> n;
  memset(a, 0, sizeof(a));
  memset(b, 0, sizeof(b));
  for (int i = 0; i < n; i++) {
    cin >> xi >> yi;
    a[xi + yi]++;
    b[1000 + xi - yi]++;
  }
  for (int i = 0; i <= 2000; i++) {
    ans = ans + a[i] * (a[i] - 1) / 2 + b[i] * (b[i] - 1) / 2;
  }
  cout << ans << '\n';
  return 0;
}
