#include <bits/stdc++.h>
using namespace std;
vector<int> x, y, z;
inline int sqr(int x) { return x * x; }
inline double dist(int i, int j) {
  return sqrt(sqr(x[i] - x[j]) + sqr(y[i] - y[j]) + sqr(z[i] - z[j]));
}
int main() {
  int n;
  cin >> n;
  x.resize(n), y.resize(n), z.resize(n);
  for (int i = 0; i < n; ++i) cin >> x[i] >> y[i] >> z[i];
  double shortestTime = 1e9;
  for (int i = 1; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      double d = dist(0, i) + dist(i, j) + dist(j, 0);
      shortestTime = min(shortestTime, d / 2);
    }
  }
  cout << setprecision(10) << shortestTime << endl;
  return 0;
}
