#include <bits/stdc++.h>
using namespace std;
struct point {
  double x, y, z;
} p[5050];
double getdis(point p1, point p2) {
  return sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y) +
              (p1.z - p2.z) * (p1.z - p2.z));
}
int main() {
  int n;
  while (cin >> n) {
    double mint = 0x3f3f3f3f;
    for (int i = 0; i < n; i++) {
      cin >> p[i].x >> p[i].y >> p[i].z;
    }
    for (int i = 1; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        double t1 = getdis(p[0], p[i]);
        double t2 = getdis(p[0], p[j]);
        double t3 = getdis(p[i], p[j]);
        mint = min(mint, (t1 + t2 + t3) / 2.0);
      }
    }
    printf("%.10lf\n", mint);
  }
}
