#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;

int main () {
	int n;
	cin >> n;
	pair<int, int> ar[n];
	for (int i = 0; i < n; i++) {
		cin >> ar[i].first >> ar[i].second;
	}
	int sol = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			ld x = ar[j].first - ar[i].first, y = ar[j].second - ar[i].second;
			ld un = 1;
			if (-un <= y/x && y/x <= un) sol++;
		}
	}
	cout << sol << '\n';
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>
// #include "atcoder/all"

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


void solve(std::vector<long long> r, std::vector<long long> c){
    auto calc = [&](i64 x0, i64 y0, i64 x1, i64 y1){
        if((x0 + y0 + i64(1e12)) % 2 != (x1 + y1 + i64(1e12)) % 2)
            return MOD;
        i64 cnt = 0;
        cnt += (x0 + y0) != (x1 + y1);
        cnt += (x0 - y0) != (x1 - y1);
        return cnt;
    };
    int ans = (abs(r[0] - r[1]) + abs(c[0] - c[1]) + 2) / 3;
    for(int i = -5; i < 5; ++i){
        for(int j = -5; j < 5; ++j){
            if(abs(i) + abs(j) > 3)
                continue;
            int cnt = (abs(i) + abs(j) == 0 ? 0 : 1);
            i64 nx = r[0] + i;
            i64 ny = c[0] + j;
            ans = min(ans, int(calc(nx, ny, r[1], c[1])) + cnt);
        }
    }
    cout << ans << endl;
}


signed main(){
    std::vector<long long> r(2);
    std::vector<long long> c(2);
    for(int i = 0 ; i < 2 ; i++){
        scanf("%lld",&r[i]);
        scanf("%lld",&c[i]);
    }
    solve(std::move(r), std::move(c));
    return 0;
}
