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