#include <bits/stdc++.h>
struct node {
  int x, y, z;
} q[10000];
double d[5000][5000];
int main() {
  int n, i, j;
  while (~scanf("%d", &n)) {
    double min_ = 0x3f3f3f3f;
    for (i = 1; i <= n; i++) {
      scanf("%d %d %d", &q[i].x, &q[i].y, &q[i].z);
    }
    for (i = 1; i <= n; i++) {
      for (j = 1 + i; j <= n; j++) {
        double h;
        h = sqrt((q[j].x - q[i].x) * (q[j].x - q[i].x) +
                 (q[j].y - q[i].y) * (q[j].y - q[i].y) +
                 (q[j].z - q[i].z) * (q[j].z - q[i].z));
        d[i][j] = d[j][i] = h;
      }
    }
    for (i = 2; i <= n; i++) {
      for (j = 2; j <= n; j++) {
        if (i != j) {
          min_ = min_ < d[i][j] + d[1][i] + d[1][j]
                     ? min_
                     : d[i][j] + d[1][i] + d[1][j];
        }
      }
    }
    printf("%.7lf\n", min_ / 2.0);
  }
}
