#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long> > xy;
vector<pair<long long, long long> > ab;
vector<long long> x;
vector<long long> y;
string str, str1, str2, star[2000];
long long ara[200005], ara2[200005];
bool flagar[200005], flagar2[200005];
bool compare(pair<long long, long long> i, pair<long long, long long> j) {
  return (i.first < j.first);
}
bool compare2(pair<long long, long long> i, pair<long long, long long> j) {
  return (i.first > j.first);
}
long long gcd(long long a, long long b) {
  if (a % b == 0) return b;
  return gcd(b, a % b);
}
long long pos[1005], neg[1005], neg1[1005];
int main() {
  long long int n, ans, temp, t, j, i, m, h, h2, m2, c, a, b, mx, d, k;
  cin >> n;
  ans = 0;
  memset(pos, 0, sizeof pos);
  memset(neg, 0, sizeof neg);
  memset(neg1, 0, sizeof neg1);
  for (i = 0; i < n; i++) {
    cin >> a >> b;
    c = a + b;
    d = a - b;
    ans += pos[c]++;
    if (d < 0)
      ans += neg1[abs(d)]++;
    else
      ans += neg[d]++;
  }
  cout << ans;
  return 0;
}
