#include <bits/stdc++.h>
using namespace std;
const double inf = 1e10;
int n;
struct P {
  int x, y, z;
  P() {}
  void Scan() { scanf("%d%d%d", &x, &y, &z); }
};
vector<P> Pt;
vector<vector<double> > R;
double Range(int x, int y) {
  if (R[x][y] != -1.0) return R[x][y];
  double xt = Pt[x].x - Pt[y].x;
  double yt = Pt[x].y - Pt[y].y;
  double zt = Pt[x].z - Pt[y].z;
  return R[x][y] = sqrt(xt * xt + yt * yt + zt * zt);
}
int main() {
  scanf("%d", &n);
  Pt.resize(n);
  for (int i = 0; i < n; ++i) Pt[i].Scan();
  vector<double> Rt(n, 1e10);
  R.resize(n, vector<double>(n, -1.0));
  Rt[0] = 0;
  vector<int> P(n, -1);
  vector<int> U(n, 0);
  for (int i = 0; i < n; ++i) {
    double x = 1e10;
    int t = -1;
    for (int j = 0; j < n; ++j) {
      if (!U[j] && Rt[j] < x) {
        t = j;
        x = Rt[j];
      }
    }
    if (t == -1 || x >= inf) break;
    for (int j = 0; j < n; ++j) {
      double tt = Range(t, j);
      if (Rt[t] + tt < Rt[j]) {
        Rt[j] = Rt[t] + tt;
        P[j] = t;
      }
    }
    U[t] = 1;
  }
  double res = inf;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (i != j && P[i] != j && P[j] != i) {
        double tt = Range(i, j);
        if (Rt[i] <= Rt[j] && Rt[j] <= Rt[i] + tt) {
          res = min(res, Rt[j] + (tt - Rt[j] + Rt[i]) / 2);
        }
      }
    }
  }
  printf("%.8lf", res);
  return 0;
}
