#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[5010], b[5010], c[5010], i, j, k;
  double ans = 0, mini = 99999, maxi, d;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i] >> b[i] >> c[i];
  }
  for (i = 1; 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[0]) * (a[i] - a[0]) + (b[i] - b[0]) * (b[i] - b[0]) +
                (c[i] - c[0]) * (c[i] - c[0]));
      d += sqrt((a[j] - a[0]) * (a[j] - a[0]) + (b[j] - b[0]) * (b[j] - b[0]) +
                (c[j] - c[0]) * (c[j] - c[0]));
      if (mini > d) {
        mini = d;
      }
    }
  ans = (ans + (mini / 2));
  printf("%f", ans);
  return 0;
}
