#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i )
typedef std::pair<int,int> pint;

using namespace std;
typedef long long ll;

int main(){
    int N;
    cin >> N;
    vector<pint> p(N);
    rep(i,N){
        cin >> p[i].first >> p[i].second;
    }
    int count = 0;
    for(int i = 0;i < (N - 1);i++){
        for(int j = i + 1;j < N;j++){
            float x = abs(p[i].first - p[j].first);
            float y = abs(p[i].second - p[j].second);
            float g = y / x;
            //cout << g << endl;
            if((0 <= g) && (g <= 1)){
                //cout << x << ' '<< y << endl;
                count++;
            }
        }
    }
    cout << count << endl;
    return 0;
}
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <complex>
#include <ctime>
#include <bitset>
// #include <atcoder/all>
#include <fstream>
#include <random>
#include <cassert>

//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;
// using namespace atcoder;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef int itn;
const ll LINF = 1e16;
const ll INF = 1e16;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(ll i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const long double PI = 3.1415926535897932;

using Graph = vector<vector<ll>>;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << setprecision(15);		// 15桁表示指定

	ll n;
	cin >> n;

	ll ans = n;

	ll b = 2;

	for (int i = 1; i <= 60; i++)
	{
		ll a = n / b;
		ll c = n % b;
		ans = min(ans, a + i + c);
		b *= 2;
	}

	cout << ans << endl;

	return 0;
}