/* 2013-08-11 09:17:07.794206 */#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <iostream>
#include <algorithm>

using namespace std;

int n;
double ans, dist[5001][5001], a[5001][3];
 
int main(){
//	freopen("d.in", "r", stdin);
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) scanf("%lf%lf%lf", &a[i][0], &a[i][1], &a[i][2]);
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
			dist[i][j] = sqrt( (a[i][0] - a[j][0]) * (a[i][0] - a[j][0]) + (a[i][1] - a[j][1]) * (a[i][1] - a[j][1]) + 
				(a[i][2] - a[j][2]) * (a[i][2] - a[j][2]));
	ans = 1e20;
	for (int i = 2; i <= n; i++)
		for (int j = i + 1; j <= n; j++)
		      ans = min(ans, (dist[1][i] + dist[1][j] + dist[i][j])/2.0);
	printf("%.10lf\n", ans);
}