#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > vec;
int grid1[2050], grid2[2050];
int main() {
  int n;
  cin >> n;
  int r = 0, c = 0;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    int x, y;
    cin >> x >> y;
    ans += grid1[x + y];
    grid1[x + y]++;
    ans += grid2[x - y + 1000];
    grid2[x - y + 1000]++;
  }
  cout << ans << endl;
  return 0;
}
