LearnPy Hub
← Arena
EasyRating 800

Equal Wealth

The king gives money so that everyone has as much as the richest citizen. How much must he give in total?

Input

n, then n amounts.

Output

One integer.

Sample 1

Input
5
0 1 2 3 4
Output
10

Sample 2

Input
3
1 1 1
Output
0
solution.py
Output appears here
Equal Wealth · Python Arena problem · LearnPy Hub