#include <bits/stdc++.h>
using namespace std;
double d(int x1, int y1, int z1, int x2, int y2, int z2) {
  int dx = x2 - x1, dy = y2 - y1, dz = z2 - z1;
  return sqrt(dx * dx + dy * dy + dz * dz);
}
int main() {
  int n;
  cin >> n;
  int x[n], y[n], z[n];
  double dist[n];
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i] >> z[i];
    dist[i] = d(x[i], y[i], z[i], x[0], y[0], z[0]);
  }
  double ans = 1e9;
  for (int i = 1; i < n; i++)
    for (int j = i + 1; j < n; j++)
      ans = min(ans, dist[i] + dist[j] + d(x[i], y[i], z[i], x[j], y[j], z[j]));
  printf("%.10f\n", ans / 2);
}
