You are given an array of integers . You can increase any element by at a cost of or decrease any element by at a cost of . Determine the minimum cost to make all elements of the array distinct. The values are allowed to be decreased so that they are negative.
Constraints
For all subtasks:
Subtask 1 [30%]
Subtask 2 [70%]
Input Specification
The first line will contain a single integer, .
The second line will contain two space-separated integers, and in that order.
The third and final line will contain space-separated integers, .
Output Specification
Output a single integer, the minimum cost required.
Sample Input
5
4 2
6 5 6 6 5
Sample Output
12
Comments