IntermediateRating 1200
Make Them Equal
In one move you add 1 to or subtract 1 from one number. Print the fewest moves to make all numbers equal.
Input
n, then n integers.
Output
One integer.
Sample 1
Input
3 1 2 3
Output
2
Sample 2
Input
4 1 10 2 9
Output
16
Output appears here