#include <bits/stdc++.h>

using ld = long double;
using vld = std::vector<ld>;
using vvld = std::vector<vld>;
using vvvld = std::vector<vvld>;
using ll = long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vvvll = std::vector<vvll>;
using str = std::string;
using vstr = std::vector<str>;

template<typename T>
bool chmin(T a, T &b) {
    return a < b ? b = a, true : false;
}

template<typename T>
bool chmax(T a, T &b) {
    return a > b ? b = a, true : false;
}

/*----------------------------------------------------------------*/

void solve() {
    ll n;
    std::cin >> n;
    
    vll x(n), y(n);
    for (ll i = 0; i < n; i++)
        std::cin >> x[i] >> y[i];
        
    ll ans = 0;
    for (ll i = 0; i < n; i++) for (ll j = i + 1; j < n; j++)
        if (std::llabs(x[i] - x[j]) >= std::llabs(y[i] - y[j]))
            ans++;
            
    std::cout << ans << '\n';
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    std::cout << std::setprecision(15);

    solve();
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=(a); i<(n); i++)
#define rrep(i,a,n) for(int i=(a); i>=(n); i--)
#define all(n) begin(n),end(n)
#define rall(n) rbegin(n),rend(n)
//#define yn(bool) if(bool){cout<<Yes<<endl;}else{cout<<No<<endl;}
#define fore(i,a) for(auto &i:a)
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
ll myceil(ll a,ll b){return (a+(b-1))/b;}
ll myfloor(ll a,ll b){return a/b;}
template <typename T> inline bool chmin(T& a, const T& b) {bool compare = a > b; if (a > b) a = b; return compare;}
template <typename T> inline bool chmax(T& a, const T& b) {bool compare = a < b; if (a < b) a = b; return compare;}
void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }

void _main() {
    int n;
    cin>>n;
    vi x(n),y(n);
    rep(i,0,n) cin>>x[i]>>y[i];
    int ans = 0;

    rep(i,0,n) {
        rep(j,i+1,n){
            if(abs(y[i]-y[j]) <= abs(x[i]-x[j])) ans++;
        }
    }
    cout<<ans<<endl;
}