#include <bits/stdc++.h>
using namespace std;
int x[5100], y[5100], z[5100];
double dst[5100];
double dest(int a, int b) {
  int dx = x[a] - x[b];
  int dy = y[a] - y[b];
  int dz = z[a] - z[b];
  return sqrt(dx * dx + dy * dy + dz * dz);
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d %d %d", &x[i], &y[i], &z[i]);
  for (int i = 0; i < n; i++) dst[i] = dest(0, i);
  double ans = 1e+100;
  for (int i = 1; i < n; i++)
    for (int j = i + 1; j < n; j++) {
      double tmp = dst[i] + dst[j] + dest(i, j);
      if (ans > tmp) ans = tmp;
    }
  ans /= 2;
  cout.precision(15);
  cout << ans << endl;
  return 0;
}
