#include <bits/stdc++.h>
using namespace std;
double pf(double x1, double x2, double y1, double y2, double z1, double z2) {
  return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) + (z1 - z2) * (z1 - z2);
}
double x[5001], y[5001], z[5001], dis[5001], Min, d;
int main() {
  int n, i, j, k;
  cin >> n;
  cin >> x[0] >> y[0] >> z[0];
  for (i = 1; i < n; i++) {
    cin >> x[i] >> y[i] >> z[i];
    dis[i] = sqrt(pf(x[0], x[i], y[0], y[i], z[0], z[i]));
  }
  Min = 2000000000;
  for (i = 1; i < n; i++)
    for (j = 1; j < n; j++) {
      if (i == j) continue;
      d = dis[i] + dis[j] + sqrt(pf(x[j], x[i], y[j], y[i], z[j], z[i]));
      if (Min > d) Min = d;
    }
  printf("%.8lf\n", Min / 2);
}
