#include<bits/stdc++.h>
using namespace std;
const int N=110;
#define pdd pair<double,double>
pdd q[N];
int n;
double rand(double l,double r)
{
    return (double)rand()/RAND_MAX*(r-l)+l;
}
double ans=1e18;
double calc(double x,double y)
{
    double res=0;
    for(int i=0;i<n;i++)
    res+=sqrt((q[i].first-x)*(q[i].first-x)+(q[i].second-y)*(q[i].second-y));
    ans=min(res,ans);
    return res;
}
void simulata_anneal()
{
    pdd cur(rand(0,10000),rand(0,10000));
    for(double T=10000;T>1e-4;T*=0.99)
    {
        pdd np(rand(cur.first-T,cur.first+T),rand(cur.second-T,cur.second+T));
        double dt=calc(np.first,np.second)-calc(cur.first,cur.second);
        if(exp(-dt/T)>rand(0,1))    cur=np;
    }
}
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>q[i].first>>q[i].second;
    for(int i=0;i<100;i++)
    simulata_anneal();
    printf("%.0lf\n",ans);
    return 0;
}