410287: GYM104002 B William and Kitty Pebbles

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. William and Kitty Pebblestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

William is cat-sitting a cat cafe, and he needs to feed the cats their favorite food, Kitty Pebbles. However, in order to prevent a cat tantrum, he needs to feed each cat the same number of Kitty Pebbles.

William pours some number of Kitty Pebbles into each cat's food bowl. Then, he needs to remove Kitty Pebbles from some of the bowls such that an equal number of Kitty Pebbles are in each bowl. The removed Kitty Pebbles get thrown out, because the cats refuse to eat anything that has been in another cat's bowl. What's the minimum number of Kitty Pebbles that get thrown out?

Input

The first line contains a single integer $$$N$$$ ($$$1 \le N \le 10^5$$$), denoting the number of cats.

The next line contains $$$N$$$ integers $$$a_1,...,a_N$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ represents the number of Kitty Pebbles William pours into the $$$i$$$th bowl.

Output

Output a single integer, the minimum number of Kitty Pebbles that can get thrown out.

ExampleInput
4
8 3 5 2
Output
10

加入题单

算法标签: