#include <bits/stdc++.h>
using namespace std;
const int www = 9;
const int Size = 10000;
char buffer[Size];
int dr[] = {-1, 0, 1, 0};
int dc[] = {0, 1, 0, -1};
const int inf = 0x0fffffff;
const int size = 52;
long long dp[size][10];
int ar[size];
struct Point {
  int x, y, z;
  Point(int x = 0, int y = 0, int z = 0) : x(x), y(y), z(z) {}
};
Point operator-(const Point &a, const Point &b) {
  return Point(a.x - b.x, a.y - b.y, a.z - b.z);
}
double dist(const Point &a) {
  return sqrt((double)a.x * a.x + (double)a.y * a.y + (double)a.z * a.z);
}
int solution(int nTest) {
  int n;
  scanf("%d", &n);
  vector<Point> v;
  for (int i = 0; i < n; i++) {
    int x, y, z;
    scanf("%d%d%d", &x, &y, &z);
    v.push_back(Point(x, y, z));
  }
  double m = 10e8;
  Point cent = v[0];
  for (int i = 1; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      Point a = v[i], b = v[j];
      double x = dist(a - cent);
      double y = dist(b - cent);
      double d = dist(a - b);
      double time = (x + d - y) / 2 + y;
      m = min(m, time);
    }
  }
  printf("%.7lf\n", m);
  return 0;
}
int main() {
  int i = 0, n = 9999;
  while (i < n && solution(i)) {
    i++;
  }
  return 0;
}
