#include <bits/stdc++.h>
using namespace std;
typedef struct {
  double x, y, z;
} tetik;
tetik tik[5002];
int n;
double a, b, x, r, mi;
double pyt(tetik aa, tetik bb) {
  double dx, dy, dz;
  dx = aa.x - bb.x;
  dy = aa.y - bb.y;
  dz = aa.z - bb.z;
  return dx * dx + dy * dy + dz * dz;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lf%lf%lf", &tik[i].x, &tik[i].y, &tik[i].z);
  }
  mi = 1e+300;
  for (int i = 1; i <= n - 1; i++) {
    for (int j = i + 1; j <= n - 1; j++) {
      a = sqrt(pyt(tik[i], tik[0]));
      b = sqrt(pyt(tik[j], tik[0]));
      x = sqrt(pyt(tik[i], tik[j]));
      r = (b + x - a) / (2 * x);
      if ((0 <= r) && (r <= 1)) {
        mi = min(mi, a + r * x);
      }
    }
  }
  printf("%.10lf\n", mi);
  return 0;
}
