#include <bits/stdc++.h>
using namespace std;
int n;
double x[5000 + 1], y[5000 + 1], z[5000 + 1];
vector<pair<double, int> > ds;
double cal(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 input(void) {
  double dis, tmp;
  scanf("%d", &n);
  for (register int i = 1; i <= n; i++) {
    scanf("%lf%lf%lf", x + i, y + i, z + i);
    ds.push_back(pair<double, int>(cal(x[1], y[1], z[1], x[i], y[i], z[i]), i));
  }
  sort(ds.begin(), ds.end());
  int a = ds[1].second, b = ds[2].second;
  dis = ds[1].first + ds[2].first + cal(x[a], y[a], z[a], x[b], y[b], z[b]);
  for (register int i = 3; i <= n - 1; i++) {
    a = ds[i].second;
    for (register int j = 1; j <= i - 1; j++) {
      b = ds[j].second;
      tmp = ds[i].first + ds[j].first;
      if (tmp > dis) break;
      tmp += cal(x[a], y[a], z[a], x[b], y[b], z[b]);
      dis = min(dis, tmp);
    }
  }
  printf("%lf\n", dis / 2);
  return 0;
}
int main(void) {
  input();
  return 0;
}
