LearnPy Hub
← Arena
IntermediateRating 1200

Raise All But One

In one move you add 1 to every number except one (you choose which). 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
3

Sample 2

Input
3
1 1 1
Output
0
solution.py
Output appears here
Raise All But One · Python Arena problem · LearnPy Hub