#include <bits/stdc++.h>
using namespace std;
int x[5000], y[5000], z[5000];
double ro(int i, int j) {
  double ans = (x[i] - x[j]) * (x[i] - x[j]);
  ans += (y[i] - y[j]) * (y[i] - y[j]);
  ans += (z[i] - z[j]) * (z[i] - z[j]);
  ans = sqrt(ans);
  return ans;
}
int main() {
  int n;
  cin >> n;
  double minnn = 1000000000;
  for (int i = 0; i < n; i++) cin >> x[i] >> y[i] >> z[i];
  for (int i = 1; i < n - 1; i++)
    for (int j = i + 1; j < n; j++) {
      double ans = ro(0, j) + ro(0, i) + ro(i, j);
      ans /= 2.0;
      if (ans < minnn) minnn = ans;
    }
  cout.precision(12);
  cout << minnn;
  return 0;
}
