#include <bits/stdc++.h>
using namespace std;
template <class T>
void sortv(T a) {
  sort(a.begin(), a.end());
}
template <class T>
void vin(T a) {
  for (int i = 0; i < a.size(); i++) cin >> a[i];
}
int main() {
  vector<int> vert, horiz;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    vert.push_back(a - b);
    horiz.push_back(a + b);
  }
  int l = 0;
  long long r = 0;
  vert.push_back(19234532);
  horiz.push_back(12312311);
  sort(vert.begin(), vert.end());
  sort(horiz.begin(), horiz.end());
  for (int i = 1; i < n + 1; i++) {
    if (vert[i] != vert[i - 1]) {
      cerr << i - l << " ";
      r += (i - l) * (i - l - 1) / 2;
      l = i;
    }
  }
  cerr << "\n";
  l = 0;
  for (int i = 1; i < n + 1; i++) {
    if (horiz[i] != horiz[i - 1]) {
      cerr << i - l << " ";
      r += (i - l) * (i - l - 1) / 2;
      l = i;
    }
  }
  cout << r << "\n";
}
