#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n;
int x[1010], y[1010];

bool check(int i, int j) {
    if (x[j] - x[i] > 0)
        return (x[i] - x[j] <= y[j] - y[i]) && (y[j] - y[i] <= x[j] - x[i]);
    return (x[i] - x[j] >= y[j] - y[i]) && (y[j] - y[i] >= x[j] - x[i]);
}

int solve() {
    int res = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i+1; j < n; j++) {
            if (check(i, j)) {
                res++;
            }
        }
    }
    return res;
}

void input() {
    cin >> n;
    for (int i = 0; i < n; i++) cin >> x[i] >> y[i];
}

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

    input();
    cout << solve() << endl;
}

#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

#define rep(i, n) for(int i = 0;i < n;i++)
const int INF = 1LL << 30;
const int MOD = 1000000007;


double abs_slope(pii a, pii b){
    return abs(a.second-b.second+0.0)/abs(a.first-b.first+0.0);
}

int main(){
    std::ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n; cin >> n;

    std::vector<pair<int,int>> points(n);
    rep(i,n){
        int x,y; cin >> x >> y;
        points[i].first = x;
        points[i].second = y;
    }

    int cnt = 0;

    rep(i,n) for(int j=i+1; j<n; j++){
        if(abs_slope(points[i], points[j]) <= 1) cnt++;
    }

    cout << cnt << endl;
    
    return 0;
}