#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
const int mod = (int)1e9 + 7;
const double pi = acos(-1.0);
const double eps = 1e-9;
struct Point {
  double x, y, z;
  Point() {}
  Point(double x, double y, double z) : x(x), y(y), z(z) {}
  void read() { scanf("%lf%lf%lf", &x, &y, &z); }
  double dist(Point o) {
    return sqrt(((o.x - x) * (o.x - x)) + ((o.y - y) * (o.y - y)) +
                ((o.z - z) * (o.z - z)));
  }
} a[5 * 1005];
int n;
double calc(Point a, Point b, Point c) {
  return a.dist(b) + a.dist(c) + b.dist(c);
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) a[i].read();
  double mn = inf * 1.0 * inf;
  for (int i = 1; i < n; i++)
    for (int j = i + 1; j < n; j++) mn = min(mn, calc(a[0], a[i], a[j]));
  printf("%.9lf\n", mn / 2.0);
  return 0;
}
