#include <bits/stdc++.h>
using namespace std;
int static_init = []() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout << fixed;
  return 0;
}();
constexpr int N = 5e3;
int16_t x[N], y[N], z[N];
double Dist(int i, int j) {
  int dx = x[i] - x[j];
  int dy = y[i] - y[j];
  int dz = z[i] - z[j];
  return sqrt(dx * dx + dy * dy + dz * dz);
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> x[i] >> y[i] >> z[i];
  auto ans = numeric_limits<double>::infinity();
  for (int i = 1; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      ans = min(ans, 0.5 * (Dist(0, i) + Dist(0, j) + Dist(i, j)));
    }
  }
  cout << setprecision(7) << ans << endl;
  return 0;
}
