program roadz;
var
i,j:longint;
l,r:array[1..5000]of double;
n:longint;
a:array[1..5000]of double;
c,e:double;
d:integer;
tot:double;
begin
assign(input,'roadz.in');
reset(input);
assign(output,'roadz.out');
rewrite(output);
readln(n);
for i:=1 to n do
readln(l[i],r[i]);
a[1]:=0;
for i:=2 to n do
begin
a[i]:=sqrt((l[1]-l[i])*(l[1]-l[i])+(r[1]-r[i])*(r[1]-r[i]));
end;
tot:=0;
for i:=2 to n do
begin
c:=9999999999;
d:=0;
for j:=2 to n do
if a[j]<>0 then
if a[j]<c then
begin
c:=a[j];
d:=j;
end;
tot:=tot+c;
a[d]:=0;
for j:=2 to n do
if a[j]<>0 then
begin
e:=sqrt((l[d]-l[j])*(l[d]-l[j])+(r[d]-r[j])*(r[d]-r[j]));
if e<a[j] then
a[j]:=e;
end;
end;
writeln(tot:0:2);
close(input);
close(output);
end.