#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<pair<int, int> > arr(n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &arr[i].first, &arr[i].second);
  }
  long long left[1000];
  long long right[1000];
  long long up[2001];
  memset(left, 0, sizeof(left));
  memset(right, 0, sizeof(right));
  memset(up, 0, sizeof(up));
  for (int i = 0; i < n; i++) {
    int diff = arr[i].first - arr[i].second;
    int sum = arr[i].first + arr[i].second;
    if (diff >= 0) {
      left[diff]++;
    } else {
      right[-1 * diff]++;
    }
    up[sum]++;
  }
  long long ans = 0;
  for (int i = 0; i < 1000; i++) {
    ans = ans + (left[i] * (left[i] - 1) / 2) + (right[i] * (right[i] - 1) / 2);
  }
  for (int i = 0; i < 2001; i++) {
    ans = ans + (up[i] * (up[i] - 1) / 2);
  }
  printf("%lld\n", ans);
}
