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