#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int a[2010] = {0}, b[2010] = {0};
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    a[x - y + 1000] += 1;
    b[x + y] += 1;
  }
  long long result = 0;
  for (int i = 0; i < 2002; i++) {
    result += a[i] * (a[i] - 1) / 2;
    result += b[i] * (b[i] - 1) / 2;
  }
  cout << result;
  return 0;
}
