#include <bits/stdc++.h>
using namespace std;
const int N = 5005;
int x[N], y[N], z[N];
double dist(int i, int j) {
  double s = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]) +
             (z[i] - z[j]) * (z[i] - z[j]);
  return sqrt(s);
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d%d", &x[i], &y[i], &z[i]);
  }
  double ans = 1000000000.0;
  for (int i = 2; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      double ret = dist(1, i) + dist(i, j) + dist(j, 1);
      ans = min(ans, ret);
    }
  }
  printf("%.8f\n", ans / 2);
  return 0;
}
