#include <bits/stdc++.h>
using namespace std;
int x[5100], y[5100], z[5100];
double dis(int i, int j) {
  int dx = x[i] - x[j], dy = y[i] - y[j], dz = z[i] - z[j];
  return sqrt(dx * dx + dy * dy + dz * dz + 0.0);
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) scanf("%d %d %d", &x[i], &y[i], &z[i]);
  double res = dis(1, 2) + dis(2, 3) + dis(3, 1);
  for (int i = 2; i < n; ++i)
    for (int j = i + 1; j <= n; ++j)
      res = min(res, dis(1, i) + dis(i, j) + dis(j, 1));
  printf("%.10lf\n", res / 2.0);
  return 0;
}
