Star capture
Time limit1sMemory limit512 MB
Given N integer star positions, find the minimum total length of the rope segments left after the capture steps, where the rope wraps stars in layers.
Problem
Star uses a rope to capture stars. The capture goes as follows.
- Wrap the rope around all the stars to be captured and pull it taut. The rope segments between stars must be taut, and the part of the rope that Star holds must run parallel and must not meet.

- Leaving out the stars that touched the rope in step 1, pull both hands closer together while still holding the rope, just far enough that the remaining stars do not touch it.

- Pull with all your strength.

Capturing stars can overload the rope until it snaps, so Star wants to reduce the load. Star found that the load gets smaller when the sum of the lengths of the rope segments between stars in step 2 gets smaller.

So the task is to minimize the sum of the lengths of the rope segments between stars. Find how far that sum can be reduced.
Input
The first line contains the number of stars .
From the second line on, lines each give the position of one star, separated by a space, one star per line. and are integers. No two or more stars share the same position.
Output
Print the minimum possible sum of the lengths of the rope segments between stars.
An absolute or relative error of up to is allowed.