#K85907. Minimum Operations to Equalize Elements
Minimum Operations to Equalize Elements
Minimum Operations to Equalize Elements
In this problem, you are given a list of integers. Your task is to determine the minimum number of operations required to make all elements equal. In one operation, you can increase any element by 1. It turns out that the minimum number of operations needed is exactly , where is the list of integers.
For example, consider the list [1, 3, 2, 2]. The maximum element is 3 and the minimum element is 1, so the answer is .
inputFormat
The first line contains an integer () denoting the number of elements in the list. The second line contains space-separated integers representing the elements of the list.
outputFormat
Output a single integer which is the minimum number of operations required to make all elements equal.## sample
1
5
0
</p>