#include <bits/stdc++.h>
using namespace std;
double dist[5001][5001];
double x[5001], y[5001], z[5001];
int n;
double sqr(double x) { return x * x; }
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> x[i] >> y[i] >> z[i];
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      dist[i][j] = sqrt(sqr(x[i] - x[j]) + sqr(y[i] - y[j]) + sqr(z[i] - z[j]));
      dist[j][i] = dist[i][j];
    }
  }
  double distance = 100000;
  for (int i = 2; i <= n; i++) {
    double minn = 100000;
    for (int j = 2; j <= n; j++) {
      if (i != j) {
        if (dist[1][j] + dist[j][i] < minn) minn = dist[1][j] + dist[j][i];
      }
    }
    if (dist[1][i] + (minn - dist[1][i]) / 2 < distance)
      distance = dist[1][i] + (minn - dist[1][i]) / 2;
  }
  cout.precision(20);
  cout << distance;
  return 0;
}
