#include <bits/stdc++.h>
using namespace std;
double dist(double a, double b, double c, double p, double q, double r) {
  return sqrt((a - p) * (a - p) + (b - q) * (b - q) + (c - r) * (c - r));
}
int main() {
  int n;
  cin >> n;
  vector<int> x(n), y(n), z(n);
  for (register int i = (0); i < (int)(n); ++i) cin >> x[i] >> y[i] >> z[i];
  double res = 1e10;
  for (register int i = (1); i < (int)(n); ++i)
    for (register int j = (i + 1); j < (int)(n); ++j) {
      double tmp = dist(x[i], y[i], z[i], x[0], y[0], z[0]);
      tmp += dist(x[i], y[i], z[i], x[j], y[j], z[j]);
      tmp += dist(x[j], y[j], z[j], x[0], y[0], z[0]);
      res = min(res, tmp / 2);
    }
  cout << fixed << setprecision(10) << res << "\n";
  return 0;
}
