A new city has been founded! The city has n houses, but no roads yet. The city council hired a construction company to build roads between the houses, so that one can go from any house to another by a road path. The cost of building a road is calculated depending on the value a of each house. The cost of building the road between house i and house j, is the absolute value of the difference between their values: |ai−aj|. The council needs to minimize the total cost of building the roads.