#include <bits/stdc++.h>
using namespace std;
int main() {
  map<long long, int> mp1, mp2;
  long long ans = 0;
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    long long x, y;
    scanf("%lld %lld", &x, &y);
    ans += mp1[x + y]++;
    ans += mp2[x - y]++;
  }
  cout << ans << endl;
  return 0;
}
