#include <bits/stdc++.h>
using namespace std;
struct point {
  int x, y, z;
  point() {}
};
double dis(point A, point B) {
  return sqrt(pow(A.x - B.x, 2) + pow(A.y - B.y, 2) + pow(A.z - B.z, 2));
}
double per(point A, point B, point C) {
  return dis(A, B) + dis(B, C) + dis(C, A);
}
point p[5000];
int main() {
  int n, i, k;
  double ret = 1000000000;
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d %d %d", &p[i].x, &p[i].y, &p[i].z);
  for (i = 1; i < n - 1; i++)
    for (k = i + 1; k < n; k++) ret = min(ret, 0.5 * per(p[0], p[i], p[k]));
  printf("%.10lf", ret);
  return 0;
}
