#include <bits/stdc++.h>
using namespace std;
long double SQR(long double x) { return x * x; }
struct point {
  int x, y, z;
  void read() { scanf("%d%d%d", &x, &y, &z); }
  double dist(point b) {
    return sqrt(SQR(x - b.x) + SQR(y - b.y) + SQR(z - b.z));
  }
} a[5050];
int n;
long double ans = 1e100, t1, t2, t3, now;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) a[i].read();
  for (int i = 1; i < n; ++i) {
    t1 = a[0].dist(a[i]);
    for (int j = i + 1; j < n; ++j) {
      t2 = a[0].dist(a[j]);
      t3 = a[i].dist(a[j]);
      now = (t1 + t2 + t3) / 2;
      if (now < ans) ans = now;
    }
  }
  cout.precision(12);
  cout << fixed << ans << endl;
  return 0;
}
