#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5001;
double x[MAXN], y[MAXN], z[MAXN];
double dis[MAXN];
inline double calc(double x1, double y1, double z1, double x2, double y2,
                   double z2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) +
              (z1 - z2) * (z1 - z2));
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%lf%lf%lf", &x[i], &y[i], &z[i]);
  for (int i = 1; i < n; i++) dis[i] = calc(x[0], y[0], z[0], x[i], y[i], z[i]);
  double ans = 2147483647.0;
  for (int i = 1; i < n; i++)
    for (int j = 1; j < n; j++)
      if (i != j) {
        double d = calc(x[i], y[i], z[i], x[j], y[j], z[j]);
        double t = (dis[i] + dis[j] + d) / 2.0;
        ans = min(t, ans);
      }
  printf("%.10f\n", ans);
  return 0;
}
