#include <bits/stdc++.h>
using namespace std;
int n;
int x, y;
map<int, int> arr, arr2;
set<long long> sett;
long long cnt(long long x) { return x * (x - 1) / 2; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x >> y;
    arr[(x - y)]++;
    arr2[x + y]++;
  }
  long long ans = 0;
  for (int i = -1000; i <= 2000; i++) {
    ans += cnt(arr[i]);
    ans += cnt(arr2[i]);
  }
  cout << ans << endl;
}
