#include <bits/stdc++.h>
using namespace std;
int a[200005];
int main() {
  int i, j, n, m;
  cin >> n;
  long long s = 0;
  for (i = 0; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    s += a[x - y + 100000];
    s += a[x + y + 150000];
    a[x - y + 100000]++;
    a[x + y + 150000]++;
  }
  cout << s << endl;
}
