Problem Description
Given an integer and an array of integers. You are allowed to perform the following operation any number of times: choose one element of the array and increase it by 1.
Determine the minimum number of such operations required for all elements of the array to become equal.
Input Format
In the first line, an integer is given - the number of elements in the array . In the second line, natural integers are recorded - the elements of the array. The values of the numbers do not exceed .
Output Format
Print the minimum number of such operations needed for all elements of the array to become the same.
Examples
Example 1
Input
2 1 9
Output
8
Example 2
Input
3 20 2 5
Output
33