#include <bits/stdc++.h>
using namespace std;
int n, m;
double x[5005], y[5005], z[5005];
double cal(int i, int j) {
  double d1 =
      sqrt(pow(x[i] - x[0], 2) + pow(y[i] - y[0], 2) + pow(z[i] - z[0], 2));
  d1 += sqrt(pow(x[j] - x[0], 2) + pow(y[j] - y[0], 2) + pow(z[j] - z[0], 2));
  d1 += sqrt(pow(x[i] - x[j], 2) + pow(y[i] - y[j], 2) + pow(z[i] - z[j], 2));
  return d1;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i] >> z[i];
  }
  double ans = -1;
  for (int i = 1; i < n; i++)
    for (int j = i + 1; j < n; j++) {
      if (ans == -1) {
        ans = cal(i, j);
      } else {
        ans = min(ans, cal(i, j));
      }
    }
  printf("%.10f\n", ans / 2);
  return 0;
}
