#include <bits/stdc++.h>
using namespace std;
double x[5005], y[5005], z[5005];
double dis(int i, int j) {
  double xx = x[i] - x[j];
  double yy = y[i] - y[j];
  double zz = z[i] - z[j];
  return sqrt(xx * xx + yy * yy + zz * zz);
}
double d[5005];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    scanf("%lf%lf%lf", x + i, y + i, z + i);
    d[i] = dis(1, i);
  }
  double ans = 1e50;
  for (int i = 2; i <= n; ++i)
    for (int j = i + 1; j <= n; ++j) ans = min(ans, d[i] + d[j] + dis(i, j));
  printf("%.10lf\n", ans / 2);
  return 0;
}
