#include <bits/stdc++.h>
using namespace std;
long long* input(long long n) {
  long long* arr = new long long[n];
  for (long long i = 0; i < n; i++) cin >> arr[i];
  return arr;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
struct node {
  long long x, y;
  bool vis = false;
};
signed main() {
  long long n;
  cin >> n;
  map<long long, long long> mp1, mp2;
  for (long long i = 0; i < n; i++) {
    long long x, y;
    cin >> x >> y;
    mp1[x + y]++;
    mp2[x - y]++;
  }
  long long count = 0;
  for (auto it = mp1.begin(); it != mp1.end(); it++) {
    count += (it->second * (it->second - 1)) / 2;
  }
  for (auto it = mp2.begin(); it != mp2.end(); it++) {
    count += (it->second * (it->second - 1)) / 2;
  }
  cout << count << endl;
}
