#include <bits/stdc++.h>
using namespace std;
double t = 1e9, x[5005], y[5005], z[5005];
double L(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, i, j;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%lf %lf %lf", &x[i], &y[i], &z[i]);
  for (i = 2; i <= n; i++)
    for (j = 2; j < i; j++) t = min(t, L(1, j) + L(1, i) + L(i, j));
  return printf("%.10lf\n", t / 2), 0;
}
