#include <bits/stdc++.h>
using namespace std;
#define fo(a,b) for(int64_t a=0;a<b;a++)
#define sor(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define ll int64_t
#define mod 1000000007
#define vl vector<int64_t>

int main() {
  ll n,ans;
  ll s,t;
  s=0;
  t=0;
  ans=0;
  cin>>n;
 vector<vector<ll>> da(n, vector<ll>(2));
  fo(i,n){
    fo(j,2){
      cin>>da.at(i).at(j);
    }
  }
  fo(i,n){
    fo(j,n){
      if(i!=j){
        s=abs(da.at(j).at(1)-da.at(i).at(1));
        t=abs(da.at(j).at(0)-da.at(i).at(0));
        if(s<=t){ans++;}
      }
    }
  }
  cout<<ans/2<<endl;
}
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;

int main() {
  int n;
  cin >> n;
  vector<pair<int, int>> p(n);
  for (auto &&[x, y] : p) {
    cin >> x >> y;
  }
  sort(begin(p), end(p));
  int ans = 0;
  for (auto i = begin(p); i != end(p); ++i) {
    for (auto j = begin(p); j != i; ++j) {
      auto y = i->second - j->second;
      auto x = i->first - j->first;
      if (abs(y) > x)
        ;
      else
        ++ans;
    }
  }
  cout << ans << "\n";
}
