#include <bits/stdc++.h>
using namespace std;
int n;
double d[5001][5001];
double x[5001], y[5001], z[5001];
double dist(int a, int b) {
  return sqrt((x[a] - x[b]) * (x[a] - x[b]) + (y[a] - y[b]) * (y[a] - y[b]) +
              (z[a] - z[b]) * (z[a] - z[b]));
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lf %lf %lf", &x[i], &y[i], &z[i]);
  for (int i = 1; i <= n; i++) {
    d[i][i] = 0;
    for (int j = i + 1; j <= n; j++) {
      d[i][j] = dist(i, j);
      d[j][i] = d[i][j];
    }
  }
  double MIN = 1000000000.000;
  for (int i = 2; i <= n; i++)
    for (int j = i + 1; j <= n; j++)
      if (d[1][i] + d[1][j] + d[i][j] + 1e-7 < MIN)
        MIN = d[1][i] + d[1][j] + d[i][j];
  printf("%.7lf", MIN / 2);
  return 0;
}
