#include <bits/stdc++.h>
using namespace std;
const double PI = 2 * acos(0.0);
void fastInOut();
int power(int z, int i) {
  int zz = 1;
  for (int k = 0; k < i; k++) {
    zz *= z;
  }
  return zz;
}
long long power(long long x, long long y) {
  long long z = 1;
  for (long long i = 0; i < y; i++) z *= x;
  return z;
}
unsigned long long power(unsigned long long b, unsigned long long pow) {
  if (b == 0)
    return 0;
  else if (pow == 1)
    return b;
  else if (pow % 2 == 0)
    return power(b * b, pow / 2);
  else
    return b * power(b * b, pow / 2);
}
int main() {
  fastInOut();
  int n, x, y, res1 = 0, res2 = 0, sum = 0;
  cin >> n;
  vector<pair<int, int>> v;
  while (n--) {
    cin >> x >> y;
    v.push_back({x, y});
  }
  int arr[100000] = {0};
  arr[2] = 1;
  for (int i = 3; i < 100000; i++) arr[i] = arr[i - 1] + (i - 1);
  for (int i = 1; i <= 1000; i++) {
    res1 = res2 = 0;
    for (int k = 0; k < v.size(); k++) {
      if (1 + i == v[k].first + v[k].second) res1++;
      if (1 - i == v[k].first - v[k].second) res2++;
    }
    sum += (arr[res1] + arr[res2]);
    res1 = res2 = 0;
    if (i > 1 && i < 1000) {
      for (int k = 0; k < v.size(); k++) {
        if (1000 + i == v[k].first + v[k].second) res1++;
        if (1000 - i == v[k].first - v[k].second) res2++;
      }
    }
    sum += (arr[res1] + arr[res2]);
  }
  cout << sum;
}
void fastInOut() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL), cout.tie(NULL);
}
