#include <bits/stdc++.h>
long n;
long long x[5005] = {0}, y[5005] = {0}, z[5005] = {0};
long long a[5005][5005] = {0};
long long qrt(long long a) { return (a * a); }
int main() {
  long i, j, k, p = 0;
  double ans = 0.0, s;
  scanf("%ld", &n);
  for (i = 1; i <= n; i++) scanf("%I64d%I64d%I64d", &x[i], &y[i], &z[i]);
  for (i = 1; i <= n; i++)
    for (j = i + 1; j <= n; j++)
      a[i][j] = qrt(x[i] - x[j]) + qrt(y[i] - y[j]) + qrt(z[i] - z[j]);
  for (i = 1 + 1; i <= n; i++)
    for (j = i + 1; j <= n; j++) {
      if (!p) {
        ans = (sqrt((double)a[1][i]) + sqrt((double)a[1][j]) +
               sqrt((double)a[i][j])) /
              2.0;
        p = 1;
      } else {
        s = (sqrt((double)a[1][i]) + sqrt((double)a[1][j]) +
             sqrt((double)a[i][j])) /
            2.0;
        if (ans > s) ans = s;
      }
    }
  printf("%.10lf\n", ans);
  return (0);
}
