#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  map<int, int> m1;
  map<int, int> m2;
  int ans = 0;
  while (t--) {
    int x, y;
    cin >> x >> y;
    ans += m1[x + y]++;
    ans += m2[x - y]++;
  }
  cout << ans << endl;
}
