#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  int b[n];
  int x, y;
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &x, &y);
    a[i] = y - x;
    b[i] = x + y;
  }
  sort(a, a + n);
  sort(b, b + n);
  long long int ctr = 1;
  long long int ctr1 = 1;
  long long int ans = 0;
  for (int i = 1; i < n; i++) {
    if (a[i] == a[i - 1])
      ctr++;
    else {
      long long int k = ctr * (ctr - 1);
      k = k / 2;
      ans += k;
      ctr = 1;
    }
    if (b[i] == b[i - 1]) {
      ctr1++;
    } else {
      long long int k = ctr1 * (ctr1 - 1);
      k = k / 2;
      ans += k;
      ctr1 = 1;
    }
  }
  long long int k = ctr * (ctr - 1);
  k = k / 2;
  ans += k;
  k = ctr1 * (ctr1 - 1);
  k = k / 2;
  ans += k;
  ctr1 = 1;
  cout << ans;
}
