#include <bits/stdc++.h>
using namespace std;
const double INF = 1000000000;
struct point {
  double x, y, z;
};
double length(point a, point b) {
  double ans = sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y) +
                    (a.z - b.z) * (a.z - b.z));
  return ans;
}
double per(point a, point b, point c) {
  double ans = length(a, b) + length(b, c) + length(a, c);
  return ans;
}
int main() {
  int n;
  cin >> n;
  point arr[5000];
  for (int i = 0; i < n; i++) cin >> arr[i].x >> arr[i].y >> arr[i].z;
  double min = INF;
  for (int i = 1; i < n; i++)
    for (int j = i + 1; j < n; j++)
      if (per(arr[0], arr[i], arr[j]) < min) min = per(arr[0], arr[i], arr[j]);
  printf("%.9lf", min / 2);
  return 0;
}
