#include <bits/stdc++.h>
using namespace std;
map<int, int> mp1, mp2;
map<int, int>::iterator it;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  int n;
  cin >> n;
  int x, y, mxr = 0, mxc = 0;
  long long ans = 0, temp;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    mp1[x - y]++;
    mp2[x + y]++;
  }
  for (it = mp1.begin(); it != mp1.end(); it++) {
    temp = ((((it->second) - 1) * (it->second)) / 2);
    ans += temp;
  }
  for (it = mp2.begin(); it != mp2.end(); it++) {
    temp = ((((it->second) - 1) * (it->second)) / 2);
    ans += temp;
  }
  cout << ans;
}
