#include <bits/stdc++.h>
using namespace std;
struct Point {
  int x, y, z;
} a[5001];
inline int sqr(int x) { return x * x; }
double dist(Point &a, Point &b) {
  return sqrt(sqr(a.x - b.x) + sqr(a.y - b.y) + sqr(a.z - b.z));
}
int main() {
  int n, i, j;
  scanf("%d", &n);
  for (i = 1; i <= n; ++i) scanf("%d%d%d", &a[i].x, &a[i].y, &a[i].z);
  double ans = 1e20;
  for (i = 2; i < n; ++i)
    for (j = i + 1; j <= n; ++j)
      ans = min(ans, dist(a[1], a[i]) + dist(a[1], a[j]) + dist(a[i], a[j]));
  printf("%.7lf\n", ans * 0.5);
  return 0;
}
