#include <bits/stdc++.h>
using namespace std;
map<int, int> sum, sub;
int main() {
  int n;
  scanf(" %d", &n);
  for (int i = 0; i < n; i++) {
    int a, b;
    scanf(" %d %d", &a, &b);
    sub[b - a] = sub[b - a] + 1;
    sum[a + b] = sum[a + b] + 1;
  }
  long long int r = 0;
  for (map<int, int>::iterator it = sub.begin(); it != sub.end(); it++) {
    long long int at = it->second;
    r += at * (at - 1) / 2;
  }
  for (map<int, int>::iterator it = sum.begin(); it != sum.end(); it++) {
    long long int at = it->second;
    r += at * (at - 1) / 2;
  }
  printf("%lld\n", r);
  return 0;
}
