#include <bits/stdc++.h>
using namespace std;
struct cor {
  int x, y, z;
} a[7000];
double ans;
int n;
int sqr(int x) { return x * x; }
double dis(int x, int y) {
  return sqrt(sqr(a[x].x - a[y].x) + sqr(a[x].y - a[y].y) +
              sqr(a[x].z - a[y].z));
}
int main() {
  cout.setf(ios::fixed);
  cout.precision(6);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i].x >> a[i].y >> a[i].z;
  ans = dis(0, 1) + dis(1, 2) + dis(0, 2);
  for (int i = 1; i < n; i++)
    for (int j = i + 1; j < n; j++)
      ans = min(ans, dis(i, j) + dis(0, i) + dis(0, j));
  cout << ans / 2 << endl;
  return 0;
}
