#include <bits/stdc++.h>
using namespace std;
const int N = 5005;
struct _edge {
  int x, y, z;
} k[N];
int n;
double ans, temp;
double dis(int x, int y) {
  double ans = sqrt(((k[x].x - k[y].x) * (k[x].x - k[y].x)) +
                    ((k[x].y - k[y].y) * (k[x].y - k[y].y)) +
                    ((k[x].z - k[y].z) * (k[x].z - k[y].z)));
  return ans;
}
int main() {
  scanf("%d", &n);
  ans = 1e15;
  for (int i = 1; i <= n; i++) scanf("%d %d %d", &k[i].x, &k[i].y, &k[i].z);
  for (int i = 2; i <= n - 1; i++)
    for (int j = i + 1; j <= n; j++) {
      temp = dis(i, j) + dis(1, j) + dis(1, i);
      if (temp < ans) ans = temp;
    }
  printf("%.10lf\n", ans / 2);
  return 0;
}
