#include <bits/stdc++.h>
using namespace std;
void solve();
int main() {
  ios::sync_with_stdio(0);
  solve();
  return 0;
}
inline double sqr(double x) { return x * x; }
inline double dist(double* a, double* b) {
  return sqrt(sqr(a[0] - b[0]) + sqr(a[1] - b[1]) + sqr(a[2] - b[2]));
}
double pts[5000][3];
double d[5000];
void solve() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < 3; j++) cin >> pts[i][j];
  for (int i = 0; i < n; i++) d[i] = dist(pts[0], pts[i]);
  double ans = 1.0E100;
  for (int i = 1; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      double p = d[i] + d[j] + dist(pts[i], pts[j]);
      ans = min(ans, p / 2);
    }
  }
  cout.precision(20);
  cout << ans << '\n';
}
