eolymp
bolt
Try our new interface for solving problems
Problems

Waterpipe - 2

Waterpipe - 2

\includegraphics{https://static.e-olymp.com/content/fc/fc8e59b6d5ebe693e1124c692b01d7c16496f680.jpg} In the plan area is depicted \textbf{N} cottages, which have known coordinates \textbf{X}, \textbf{Y} (\textbf{i} = \textbf{1} .. \textbf{N}). What is the minimum length should be the total length of water pipes that connects all the houses \textbf{N} of the town, directly or through several intermediate houses? \InputFile The first line number \textbf{N} - the number of houses. The next \textbf{N} lines coordinates cottages \textbf{X}, \textbf{Y} (\textbf{i} = \textbf{1} .. \textbf{N}). All input values are natural numbers not greater than \textbf{100}. \OutputFile Single number - the total length of water pipes, rounded to integers.
Time limit 1 second
Memory limit 64 MiB
Input example #1
7
3 4
4 3
1 3
3 5
2 3
2 2
1 1
Output example #1
7