/* 2013-08-11 09:36:45.833173 */#include <cstdio>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#define sqr(x) ((x)*(x))
using namespace std;
struct data{
    int x,y,z;
    long double dis;
}A[5005];
long double ans;
inline bool operator < (data a,data b){
    return a.dis<b.dis;
}
int main(){
    int n,m,i,j,k,l;
    scanf("%d",&n);
    ans=1000000000000000.00;
    for(i=1;i<=n;i++)scanf("%d%d%d",&A[i].x,&A[i].y,&A[i].z);
    for(i=2;i<=n;i++){
        A[i].dis=sqrt((long double)sqr(A[i].x-A[1].x)+sqr(A[i].y-A[1].y)+sqr(A[i].z-A[1].z));
    }
    sort(A+2,A+1+n);
    for(i=2;i<=n;i++)
        for(j=i+1;j<=n;j++){
            long double d1=sqrt((long double)sqr(A[i].x-A[j].x)+sqr(A[i].y-A[j].y)+sqr(A[i].z-A[j].z));
            ans=min(ans,d1+A[i].dis+A[j].dis);
/*            if(A[i].dis+d1+eps<A[j].dis){
            }*/
        }
    printf("%.7f\n",(double)ans/2);
//    cout<<fixed()<<setprecision(7)<<ans<<endl;
    return 0;
}
