#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
void go() {
  long long n;
  cin >> n;
  unordered_map<long long, long long> M1, M2;
  for (int i = 0; i < n; i++) {
    long long x, y;
    cin >> x >> y;
    M1[x - y]++;
    M2[x + y]++;
  }
  long long ans = 0;
  for (auto i : M1) {
    long long t = i.second;
    ans += ((t) * (t - 1) / 2);
  }
  for (auto i : M2) {
    long long t = i.second;
    ans += ((t) * (t - 1) / 2);
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int t = 1;
  while (t--) go();
}
