In the high halls of Numeria, an archmage tends to $$$n$$$ magic crystals with powers $$$a_1, a_2, \ldots, a_n$$$. With a fusion spell, he may pick any two crystals with powers $$$x$$$ and $$$y$$$, remove them, and create a single crystal of power $$$x + y$$$. Each spell reduces the number of crystals by 1.
The archmage seeks harmony: he wants the average power of the crystals to become an integer. What is the minimum number of spells he must cast?
The first line contains an integer $$$n$$$ ($$$1 \le n \le 10^6$$$).
The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 10^3$$$).
Print a single integer: the minimum number of spells.
45 2 3 5
1
511 12 13 14 15
0
41 5 3 7
0
A string $$$U$$$ is called a subsequence of a string $$$V$$$ if $$$U$$$ can be obtained from $$$V$$$ by deleting zero or more characters without changing the relative order of the remaining characters.
| Name |
|---|


