#include <bits/stdc++.h>
using namespace std;
struct point {
  int x, y, z;
};
double DPP(point a, point b) {
  return sqrt(0.0 + ((a.x - b.x) * (a.x - b.x)) + ((a.y - b.y) * (a.y - b.y)) +
              ((a.z - b.z) * (a.z - b.z)));
}
point p[5010];
double d[5010], ans = 1000 * 1000 * 1000;
int n;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> p[i].x >> p[i].y >> p[i].z;
  for (int i = 1; i < n; i++) d[i] = DPP(p[0], p[i]);
  for (int i = 1; i < n; i++)
    for (int j = i + 1; j < n; j++) {
      double x = DPP(p[i], p[j]);
      x = (x + d[j] - d[i]) / 2;
      ans = min(ans, x + d[i]);
    }
  printf("%.7lf\n", ans);
  return 0;
}
