#include <bits/stdc++.h>
struct point {
  long x;
  long y;
  long z;
};
const long maxn = 5001;
const double inf = 2000000000;
const double eps = 1.0e-8;
point a[maxn];
double nnew, min;
long n, q, choice1, choice2;
double d[maxn];
double sqr(double x) { return (x * x); }
double dist(point a, point b) {
  return (pow(sqr(a.x - b.x) + sqr(a.y - b.y) + sqr(a.z - b.z), 0.5));
}
int main() {
  scanf("%ld", &n);
  for (q = 1; q <= n; q++) scanf("%ld%ld%ld", &a[q].x, &a[q].y, &a[q].z);
  min = inf;
  for (long h = 2; h <= n; h++) d[h] = dist(a[1], a[h]);
  for (choice1 = 2; choice1 <= n; choice1++)
    for (choice2 = choice1 + 1; choice2 <= n; choice2++) {
      nnew = (d[choice1] + d[choice2] + dist(a[choice1], a[choice2])) / 2;
      if (min - nnew > eps) min = nnew;
    }
  printf("%0.8lf", min);
}
