#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> v1, v2;
  long long cnt, ans;
  int i, n, x, y;
  while (scanf("%d", &n) == 1) {
    for (i = 0; i < n; i++) {
      scanf("%d %d", &x, &y);
      v1.push_back(x - y);
      v2.push_back(x + y);
    }
    sort(v1.begin(), v1.end());
    sort(v2.begin(), v2.end());
    ans = 0;
    cnt = 1;
    for (i = 1; i < v1.size(); i++) {
      if (v1[i] == v1[i - 1]) {
        cnt++;
      } else {
        ans += (cnt * (cnt - 1)) / 2;
        cnt = 1;
      }
    }
    ans += (cnt * (cnt - 1)) / 2;
    cnt = 1;
    for (i = 1; i < v2.size(); i++) {
      if (v2[i] == v2[i - 1]) {
        cnt++;
      } else {
        ans += (cnt * (cnt - 1)) / 2;
        cnt = 1;
      }
    }
    ans += (cnt * (cnt - 1)) / 2;
    printf("%I64d\n", ans);
    v1.clear();
    v2.clear();
  }
  return 0;
}
