#include <bits/stdc++.h>
using namespace std;
int x[5000];
int y[5000];
int z[5000];
double dist[5000];
void solve() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> x[i] >> y[i] >> z[i];
  double ret = 1e18;
  for (int i = 1; i < n; i++) {
    int xx = x[i] - x[0];
    int yy = y[i] - y[0];
    int zz = z[i] - z[0];
    dist[i] = sqrt(xx * xx + yy * yy + zz * zz);
  }
  for (int i = 1; i < n; i++) {
    for (int j = 1; j < i; j++) {
      double a = dist[i];
      double b = dist[j];
      int xx = x[i] - x[j];
      int yy = y[i] - y[j];
      int zz = z[i] - z[j];
      double d = sqrt(xx * xx + yy * yy + zz * zz);
      if (a > b) swap(a, b);
      double take = b - a;
      a += take;
      d -= take;
      ret = min(ret, a + d / 2);
    }
  }
  cout << fixed << setprecision(12) << ret << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
}
