#include <bits/stdc++.h>
using namespace std;
const int inf = 1000000000;
double m = inf;
int n, i, j, a[5001], b[5001], c[5001];
double d;
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) cin >> a[i] >> b[i] >> c[i];
  for (i = 2; i <= n - 1; i++)
    for (j = i + 1; j <= n; j++) {
      d = sqrt((a[i] - a[j]) * (a[i] - a[j]) + (b[i] - b[j]) * (b[i] - b[j]) +
               (c[i] - c[j]) * (c[i] - c[j]));
      d += sqrt((a[i] - a[1]) * (a[i] - a[1]) + (b[i] - b[1]) * (b[i] - b[1]) +
                (c[i] - c[1]) * (c[i] - c[1]));
      d += sqrt((a[1] - a[j]) * (a[1] - a[j]) + (b[1] - b[j]) * (b[1] - b[j]) +
                (c[1] - c[j]) * (c[1] - c[j]));
      if (m > d) m = d;
    }
  printf("%5f", m / 2);
  return 0;
}
