#include <bits/stdc++.h>
const int M = 5500;
const double esp = 1e-6;
const double PI = 3.14159265359;
const int INF = 0x3f3f3f3f;
using namespace std;
struct node {
  double x, y, z;
} arr[M];
double judge(node x, node y) {
  return sqrt((x.x - y.x) * (x.x - y.x) + (x.y - y.y) * (x.y - y.y) +
              (x.z - y.z) * (x.z - y.z));
}
int main() {
  int n;
  while (~scanf("%d", &n)) {
    for (int i = 1; i <= n; i++) {
      scanf("%lf %lf %lf", &arr[i].x, &arr[i].y, &arr[i].z);
    }
    double qmin = (double)INF;
    for (int i = 2; i <= n; i++) {
      for (int j = i + 1; j <= n; j++) {
        qmin = min(qmin, judge(arr[1], arr[i]) + judge(arr[1], arr[j]) +
                             judge(arr[i], arr[j]));
      }
    }
    printf("%lf\n", qmin / 2);
  }
  return 0;
}
