#include <bits/stdc++.h>
using namespace std;
const int maxn = 5006;
const int mod = 1000000009;
double x[maxn], y[maxn], z[maxn];
double d[maxn][maxn];
int n;
double dis(double x1, double y1, double z1, double x2, double y2, double z2) {
  double dx = x1 - x2;
  double dy = y1 - y2;
  double dz = z1 - z2;
  return sqrt(dx * dx + dy * dy + dz * dz);
}
double getans() {
  double ret = 100000000000.0;
  for (int i = 1; i < n; ++i)
    for (int j = i + 1; j < n; ++j) {
      double dd = d[i][j] + d[0][i] + d[0][j];
      ret = min(ret, dd);
    }
  return ret;
}
void init() {
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j)
      d[i][j] = dis(x[i], y[i], z[i], x[j], y[j], z[j]);
}
int main() {
  while (~scanf("%d", &n)) {
    for (int i = 0; i < n; ++i) {
      scanf("%lf%lf%lf", x + i, y + i, z + i);
    }
    init();
    double ans = getans();
    ans /= 2;
    printf("%.9lf\n", ans);
  }
  return 0;
}
