#include <bits/stdc++.h>
using namespace std;
long double sq(int v) { return (long double)(v * v); }
struct t {
  int x, y, z;
  t(){};
  t(int a, int b, int c) { x = a, y = b, z = c; }
};
t v[5005];
int N;
long double dist(int a, int b) {
  return sqrt(sq(v[a].x - v[b].x) + sq(v[a].y - v[b].y) + sq(v[a].z - v[b].z));
}
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    int x, y, z;
    cin >> x >> y >> z;
    v[i] = t(x, y, z);
  }
  long double mm = 1000000000;
  for (int i = 1; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      long double d0i = dist(0, i);
      long double d0j = dist(0, j);
      long double dij = dist(i, j);
      mm = min(mm, dij + d0i + d0j);
    }
  }
  cout << fixed << setprecision(18) << mm / 2 << "\n";
  return 0;
}
