#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int x, y;
  unordered_map<int, int> m1, m2;
  int c = 0;
  for (int i = 0; i < (n); i++) {
    cin >> x >> y;
    c += m1[x + y];
    m1[x + y]++;
    c += m2[x - y];
    m2[x - y]++;
  }
  cout << c << "\n";
  return 0;
}
