#include <bits/stdc++.h>
using namespace std;
struct Pt {
  int x, y, z;
} t[50010];
int n;
double get(int i, int j) {
  return sqrt((double)((t[i].x - t[j].x) * (t[i].x - t[j].x) +
                       (t[i].y - t[j].y) * (t[i].y - t[j].y) +
                       (t[i].z - t[j].z) * (t[i].z - t[j].z)));
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> t[i].x >> t[i].y >> t[i].z;
  double ans = (1 << 30) * 1ll;
  for (int i = 2; i < n; ++i)
    for (int j = i + 1; j <= n; ++j) {
      double t2 = get(1, i);
      double t1 = get(1, j);
      double s = get(i, j);
      if (t2 > t1) swap(t1, t2);
      double T = (s - abs(t2 - t1)) * 0.5;
      ans = min(ans, T * 1.0 + max(t2, t1));
    }
  printf("%.10lf", ans);
  return 0;
}
