#include <bits/stdc++.h>
using namespace std;
struct point {
  float x, y, z;
};
point a[5000];
int n;
double t, dist[5000][5000];
double d(point x, point 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() {
  t = 1000000000;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%f", &a[i].x);
    scanf("%f", &a[i].y);
    scanf("%f", &a[i].z);
  }
  for (int i = 1; i < n; i++) dist[0][i] = d(a[0], a[i]);
  for (int i = 1; i < n; i++)
    for (int j = i + 1; j < n; j++) dist[i][j] = d(a[i], a[j]);
  for (int i = 1; i < n - 1; i++)
    for (int j = i + 1; j < n; j++) {
      t = min(t, (dist[0][i] + dist[0][j] + dist[i][j]) / 2);
    }
  printf("%.6f", t);
}
