#K57147. Minimum Adjustments to Balance Fruits
Minimum Adjustments to Balance Fruits
Minimum Adjustments to Balance Fruits
You are given a list representing the number of pieces of each type of fruit in a basket. Your task is to determine the minimum number of adjustments required to make the count of fruits equal for all types. Each adjustment consists of either adding or removing a single piece of fruit.
If the basket is empty (i.e. no fruit types are given), the required number of adjustments is 0.
For example, if the input list is [5, 7, 10, 8], then the minimum adjustments required is 6.
inputFormat
The input is provided via standard input (stdin). The first line contains an integer N, the number of fruit types. The second line contains N space-separated integers, each indicating the number of pieces for that fruit type. If N is 0, then there will be no second line.
outputFormat
Output a single integer to standard output (stdout), which is the minimum number of adjustments (additions or removals) required to balance the fruit counts.
## sample0
0