#include <bits/stdc++.h>
using namespace std;
int a[1000005], b[1000005];
int n, x, y;
long long cnt = 0;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &x, &y);
    b[y - x + 1000]++;
    a[x + y]++;
  }
  for (int i = 1; i <= 2000; i++)
    cnt += a[i] * (a[i] - 1) / 2 + b[i] * (b[i] - 1) / 2;
  cout << cnt;
  return 0;
}
