Nails#987

Nails

1 second
128 megabytes
Very easy

Some nails are hammered on a straight plank. Any two nails can be connected by a thread. Connect some pairs of nails with threads so that each nail is tied to at least one thread, and the total length of all threads is minimized.

Input

The first line contains the number of nails (2 \le n \le 100). The next line contains numbers — the coordinates of all the nails (non-negative integers not exceeding ).

Output

Print the minimum total length of all threads.

Examples

Example 1

Loading
Loading