#include <bits/stdc++.h>
using namespace std;
int n;
double ans, dist[5001][5001], a[5001][3];
int main() {
  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);
}
