#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool uax(T &x, T y) {
  return (y > x) ? x = y, true : false;
}
template <typename T>
inline bool uin(T &x, T y) {
  return (y < x) ? x = y, true : false;
}
void err(__attribute__((unused)) istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " =: " << a << endl;
  err(++it, args...);
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> &buf) {
  return os << "(" << buf.first << ": " << buf.second << ")";
}
template <typename T>
ostream &operator<<(ostream &os, vector<vector<T>> &A) {
  for (auto &B : A) os << '\n' << B;
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &A) {
  bool f = false;
  os << "{";
  for (auto &e : A) {
    if (f) os << ", ";
    os << e;
    f = true;
  }
  return os << "}";
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &A) {
  bool f = false;
  os << "{";
  for (auto &e : A) {
    if (f) os << ", ";
    os << e;
    f = true;
  }
  return os << "}";
}
template <typename T>
ostream &operator<<(ostream &os, multiset<T> &A) {
  bool f = false;
  os << "{";
  for (auto &e : A) {
    if (f) os << ", ";
    os << e;
    f = true;
  }
  return os << "}";
}
template <typename K, typename V>
ostream &operator<<(ostream &os, map<K, V> &A) {
  bool f = false;
  os << "{";
  for (auto &e : A) {
    if (f) os << ", ";
    os << e;
    f = true;
  }
  return os << "}";
}
template <typename T>
void kek(T ans) {
  cout << ans << endl;
  exit(0);
}
int const MOD = 1000000007;
long long const INF = 1e18;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<array<int, 3>> a(n);
  for (auto &[x, y, z] : a) cin >> x >> y >> z;
  auto dis = [&a](int i, int j) {
    double ret = 0;
    for (int k : {0, 1, 2}) ret += (a[i][k] - a[j][k]) * (a[i][k] - a[j][k]);
    return sqrt(ret);
  };
  double ans = INF;
  for (int i = 1; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      uin(ans, dis(0, i) + dis(0, j) + dis(i, j));
    }
  }
  ans /= 2;
  cout.precision(7);
  cout << fixed << ans << '\n';
  return 0;
}
