#include <bits/stdc++.h>
using namespace std;
const int maxn = 5010;
double x[maxn], y[maxn], z[maxn];
double dis(int i, int j) {
  return 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]));
}
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    for (int i = 0; i < n; i++) scanf("%lf%lf%lf", &x[i], &y[i], &z[i]);
    double ans = 1e12;
    for (int i = 1; i < n; i++)
      for (int j = i + 1; j < n; j++) {
        double tmp = dis(0, i) + dis(0, j) + dis(i, j);
        ans = min(ans, tmp);
      }
    printf("%.8f\n", ans / 2);
  }
}
