#include <bits/stdc++.h>
using namespace std;
struct point {
  int x, y, z;
  double dist(point& p) {
    return sqrt((double)((p.x - x) * (p.x - x) + (p.y - y) * (p.y - y) +
                         (p.z - z) * (p.z - z)));
  }
};
int N;
point P[5005];
double solve() {
  double res = 1e10;
  for (int i = 1; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      double per = P[i].dist(P[j]) + P[i].dist(P[0]) + P[j].dist(P[0]);
      if (per < res) res = per;
    }
  }
  return res / 2.0;
}
int main() {
  while (cin >> N) {
    for (int i = 0; i < N; i++) {
      cin >> P[i].x >> P[i].y >> P[i].z;
    }
    cout << setprecision(12) << solve() << endl;
  }
}
