#include <bits/stdc++.h>
using namespace std;
const int N = 5010;
struct point {
  int x, y, z;
  void read() { scanf("%d%d%d", &x, &y, &z); }
} a[N];
double dist(point p, point q) {
  return sqrt(0.0 + (p.x - q.x) * (p.x - q.x) + (p.y - q.y) * (p.y - q.y) +
              (p.z - q.z) * (p.z - q.z));
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) a[i].read();
  double ans = 1e20;
  for (int i = 2; i <= n; i++)
    for (int 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("%.20lf\n", ans / 2);
  return 0;
}
