#include<bits/stdc++.h>
using namespace std;

using i64 = long long;
using u64 = unsigned long long;

struct debug {
    ~debug(){cerr << endl;}
    template<class c> debug& operator<<(c x) {cerr << x; return *this;}
    template<class c, class d>
    debug& operator<<(pair<c, d> x) {*this << "(" << x.first << ", " << x.second << ")"; 
        return *this;}
    template<class c> debug& operator<<(vector<c> x) { *this << "[";
        int f = 0; for(auto it : x) { *this << (f?", ":""); *this << it; f = 1;}
        *this << "]"; return *this;}
};

#define dbg(x) "[" << #x << ": " << x << "]  "
#define Wa() cerr << "[LINE: " << __LINE__ << "] -> "; debug() << 
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(NULL)


int main()
{
    int n;
    scanf("%d", &n);

    vector<pair<int, int>> p;
    for(int i = 0; i < n; i++) {
        int x, y;
        scanf("%d%d", &x, &y);
        p.push_back({x, y});
    }

    int ans = 0;
    for(int i = 0; i < n; i++) {
        for(int j = i+1; j < n; j++) {
            if(abs(p[i].second - p[j].second) <= abs(p[i].first - p[j].first)) ans++;
        }
    }

    printf("%d\n", ans);
}


#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

typedef long long ll;
using P = pair<int, int>;

int main()
{
    int n;
    cin >> n;

    pair<double, double> point[n];
    rep(i, n) cin >> point[i].first >> point[i].second;

    int cnt = 0;

    for (int i = 0; i < n; ++i)
        for (int j = i + 1; j < n; ++j)
        {
            double d = (point[j].second - point[i].second) / (point[j].first - point[i].first);
            if (abs(d) <= 1)
                cnt++;
        }
    cout << cnt << endl;
    return 0;
}






