#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 23;
const int delta = (int)1e9 + 7;
map<int, int> mp1, mp2;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x, y;
    cin >> x >> y;
    mp1[x + y]++;
    mp2[x - y + 1000]++;
  }
  int ans = 0;
  for (int i = 0; i <= 2005; i++) {
    ans += (mp1[i] * (mp1[i] - 1) / 2) + (mp2[i] * (mp2[i] - 1) / 2);
  }
  cout << ans;
  return 0;
}
