#include <bits/stdc++.h>
int main(void) {
  int n, x[5000], y[5000], z[5000], i, j;
  double ans = 1e100;
  scanf("%d\n", &n);
  for (i = 0; i < n; i++) {
    scanf("%d %d %d\n", &x[i], &y[i], &z[i]);
  }
  for (i = 1; i < n; i++)
    for (j = i + 1; j < n; j++) {
      double t =
          ((sqrt((x[0] - x[i]) * (x[0] - x[i]) + (y[0] - y[i]) * (y[0] - y[i]) +
                 (z[0] - z[i]) * (z[0] - z[i]))) +
           (sqrt((x[0] - x[j]) * (x[0] - x[j]) + (y[0] - y[j]) * (y[0] - y[j]) +
                 (z[0] - z[j]) * (z[0] - z[j]))) +
           (sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]) +
                 (z[i] - z[j]) * (z[i] - z[j])))) /
          2;
      if (t < ans) ans = t;
    }
  printf("%.7f\n", ans);
  return 0;
}
