#include <bits/stdc++.h>
using namespace std;
double PI = acos(-1);
void yes() { cout << "YES\n"; }
void no() { cout << "NO\n"; }
void yesno(int f) {
  if (f)
    yes();
  else
    no();
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  vector<int> a(2100, 0), b(2100, 0);
  int n;
  cin >> n;
  while (n--) {
    int x, y;
    cin >> x >> y;
    a[x + y]++;
    b[1000 + x - y]++;
  }
  long long ans = 0;
  for (int(i) = (0); (i) < (2100); ++(i)) {
    ans += ((a[i] - 1) * a[i]) / 2;
    ans += ((b[i] - 1) * b[i]) / 2;
  }
  cout << ans << endl;
}
