#include <bits/stdc++.h>
using namespace std;
double point[5000][3];
double mine(double x, double y) { return ((x < y) ? x : y); }
double dis(double x, double y, double z, double a, double b, double c) {
  return (sqrt((x - a) * (x - a) + (y - b) * (y - b) + (z - c) * (z - c)));
}
int main() {
  double n, min = 10000000;
  double ans = 10000000;
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 3; j++) cin >> point[i][j];
  }
  for (int i = 0; i < 1; i++) {
    for (int j = i + 1; j < n - 1; j++) {
      for (int k = j + 1; k < n; k++) {
        ans = mine(ans, (dis(point[i][0], point[i][1], point[i][2], point[j][0],
                             point[j][1], point[j][2]) +
                         dis(point[j][0], point[j][1], point[j][2], point[k][0],
                             point[k][1], point[k][2]) +
                         dis(point[i][0], point[i][1], point[i][2], point[k][0],
                             point[k][1], point[k][2])));
      }
    }
  }
  printf("%.9f", ans / 2.0);
}
