#include <bits/stdc++.h>
using namespace std;
struct node {
  int x, y, z;
  double dis;
} a[5010];
double dis[5001][5002];
double cadis(int i, int j) {
  return sqrt((a[i].x - a[j].x) * (a[i].x - a[j].x) +
              (a[i].y - a[j].y) * (a[i].y - a[j].y) +
              (a[i].z - a[j].z) * (a[i].z - a[j].z));
}
double adis[5000];
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    int x, y, z;
    for (int i = 0; i < n; i++) {
      scanf("%d%d%d", &x, &y, &z);
      a[i].x = x, a[i].y = y;
      a[i].z = z;
    }
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        dis[i][j] = dis[j][i] = cadis(i, j);
      }
    }
    double ans = 9999999;
    for (int i = 1; i < n; i++) {
      adis[i] = 99999999;
      for (int j = i + 1; j < n; j++) {
        adis[i] = min(adis[i], dis[0][i] + dis[0][j] + dis[i][j]);
      }
      if (adis[i] < ans) ans = adis[i];
    }
    printf("%.10lf\n", ans / 2);
  }
}
