#include <bits/stdc++.h>
using namespace std;
struct point {
  int x, y, z;
};
point P[50001];
double dist(point &A, point &B) {
  return sqrt(((A.x - B.x) * (A.x - B.x)) + ((A.y - B.y) * (A.y - B.y)) +
              ((A.z - B.z) * (A.z - B.z)));
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) scanf("%d %d %d", &P[i].x, &P[i].y, &P[i].z);
  double mn = 10E40;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      if (i != 0 && j != 0 && i != j) {
        double d = dist(P[0], P[i]) + dist(P[0], P[j]) + dist(P[i], P[j]);
        mn = min(mn, d);
      }
  printf("%.10lf\n", mn / 2.);
  return 0;
}
