#include <bits/stdc++.h>
using namespace std;
double dist(int a, int b, int c, int d, int e, int first) {
  return sqrt((a - d) * (a - d) + (b - e) * (b - e) +
              (c - first) * (c - first));
}
int main() {
  ios_base::sync_with_stdio(0);
  int n, m;
  cin >> n;
  int a[n][3];
  double ans = 2147483647;
  for (int i = 0; i < n; ++i) cin >> a[i][0] >> a[i][1] >> a[i][2];
  for (int i = 1; i < n; ++i)
    for (int j = i + 1; j < n; ++j)
      ans = min(ans,
                dist(a[0][0], a[0][1], a[0][2], a[i][0], a[i][1], a[i][2]) +
                    dist(a[0][0], a[0][1], a[0][2], a[j][0], a[j][1], a[j][2]) +
                    dist(a[i][0], a[i][1], a[i][2], a[j][0], a[j][1], a[j][2]));
  printf("%.9f\n", ans / 2.0);
  return 0;
}
