#include <bits/stdc++.h>
using namespace std;
double n, arr[6000][4] = {0}, a, b, c;
int main() {
  cin >> n;
  cin >> a >> b >> c;
  for (int i = 0; i < n - 1; i++) {
    cin >> arr[i][0] >> arr[i][1] >> arr[i][2];
    arr[i][3] = sqrt(((a - arr[i][0]) * (a - arr[i][0])) +
                     ((b - arr[i][1]) * (b - arr[i][1])) +
                     ((c - arr[i][2]) * (c - arr[i][2])));
  }
  double aux = 1000000000;
  for (int i = 0; i < n - 1; i++) {
    for (int j = 0; j < n - 1; j++) {
      if (i != j) {
        double x =
            sqrt(pow(arr[j][0] - arr[i][0], 2) + pow(arr[j][1] - arr[i][1], 2) +
                 pow(arr[j][2] - arr[i][2], 2));
        aux = min(aux, arr[i][3] + arr[j][3] + x);
      }
    }
  }
  printf("%.10lf", aux / 2);
  return 0;
}
