## TLE '16 Contest 1 P2 - Heavy-Light Decomposition

View as PDF

Points: 5 (partial)
Time limit: 2.0s
Memory limit: 128M

Author:
Problem type

Fax McClad, Croneria's strongest bounty hunter, needs to move heavy boxes into his Kyuwing, his personal spacecraft. The box has a weight of .

Fax is strong enough to carry the boxes alone, but he is lazy and he wants his wingmate Flaco to help. Flaco is also lazy and will only carry boxes that are considered to be "light." However, the concept of "light" must be fair to both Fax and Flaco. They decide that a "light" box is a box with a weight less than or equal to the average weight of all boxes. All other boxes are "heavy."

Flaco notices a catch with this definition of "light". The average is not clearly defined, so he is allowed to determine which average (arithmetic mean, mode, or median) they should use. In the case that there is more than one value that occurs most frequently, the mode is the arithmetic mean of all such values.

Help Flaco to determine the minimum number of boxes he will carry if he optimally chooses which average to use.

#### Input Specification

The first line will contain a single integer, , the number of boxes.

lines of input follow. The line contains a single integer, .

#### Output Specification

Output a single integer, the minimum number of boxes Flaco will carry if he optimally chooses which average to use.

#### Sample Input 1

5
1
2
3
4
5

#### Sample Output 1

3

#### Sample Input 2

5
1
4
1010
1003
1005

#### Sample Output 2

2

#### Sample Input 3

5
32
5
3
84
3

#### Sample Output 3

2