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