#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
template <class T, class S>
ostream &operator<<(ostream &o, const pair<T, S> &p) {
  return o << '(' << p.first << ", " << p.second << ')';
}
template <template <class, class...> class T, class... A>
typename enable_if<!is_same<T<A...>, string>(), ostream &>::type operator<<(
    ostream &o, T<A...> V) {
  o << '[';
  for (auto a : V) o << a << ", ";
  return o << ']';
}
long double x[5010], y[5010], z[5010];
long double dst(long long int i, long long int j) {
  return sqrt(((x[i] - x[j]) * (x[i] - x[j])) +
              ((y[i] - y[j]) * (y[i] - y[j])) +
              ((z[i] - z[j]) * (z[i] - z[j])));
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long int n;
  cin >> n;
  for (long long int i = 0; i < n; i++) cin >> x[i] >> y[i] >> z[i];
  long double ans = 1000000007.;
  for (long long int i = 1; i < n; i++)
    for (long long int j = 1; j < n; j++)
      if (i - j) {
        ans = min(ans, (dst(0, i) + dst(0, j) + dst(i, j)) / (long double)2);
      }
  cout << fixed << setprecision(10) << ans << '\n';
}
