#include <bits/stdc++.h>
using namespace std;
double x[5555], y[5555], z[5555];
int n;
int main() {
  cin >> n;
  for (int(i) = 0; (i) < (n); ++(i)) cin >> x[i] >> y[i] >> z[i];
  double ans = (double)1000000000 * 1000000000;
  for (int i = 1; i < n; ++i)
    for (int j = 1; j < i; ++j) {
      double d1 =
          sqrt((x[i] - x[0]) * (x[i] - x[0]) + (y[i] - y[0]) * (y[i] - y[0]) +
               (z[i] - z[0]) * (z[i] - z[0]));
      double d2 =
          sqrt((x[j] - x[0]) * (x[j] - x[0]) + (y[j] - y[0]) * (y[j] - y[0]) +
               (z[j] - z[0]) * (z[j] - z[0]));
      double d3 =
          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]));
      ans = min(ans, (d1 + d2 + d3) / 2.0);
    }
  printf("%0.9f\n", ans);
}
