#include <bits/stdc++.h>
using namespace std;
int x[5001], y[5001], z[5001];
double dist(double x, double y, double z) {
  return sqrt(x * x + y * y + z * z);
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d%d%d", x + i, y + i, z + i);
  }
  double menor = 1000000000.0;
  for (int i = 1; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      double temp = dist(x[i] - x[0], y[i] - y[0], z[i] - z[0]) +
                    dist(x[j] - x[0], y[j] - y[0], z[j] - z[0]) +
                    dist(x[j] - x[i], y[j] - y[i], z[j] - z[i]);
      if (temp < menor) {
        menor = temp;
      }
    }
  }
  printf("%.10f\n", menor / 2);
}
