Codeforces Round 303 (Div. 2)
D
Queue
Codeforces
1300
原题
← CE →
翻译中…

Little girl Susie went shopping with her mom and she wondered how to improve service quality.

翻译中…

There are $*n*$ people in the queue. For each person we know time $*t*_{*i*}$ needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when all the people who stand in the queue in front of him are served. Susie thought that if we swap some people in the queue, then we can decrease the number of people who are disappointed.

翻译中…

Help Susie find out what is the maximum number of not disappointed people can be achieved by swapping people in the queue.

翻译中…

Input

翻译中…

The first line contains integer $*n*$ ($1 ≤ *n* ≤ 10^{5}$).

翻译中…

The next line contains $*n*$ integers $*t*_{*i*}$ ($1 ≤ *t*_{*i*} ≤ 10^{9}$), separated by spaces.

翻译中…

Output

翻译中…

Print a single number — the maximum number of not disappointed people in the queue.

翻译中…

Note

翻译中…

Value $4$ is achieved at such an arrangement, for example: $1, 2, 3, 5, 15$. Thus, you can make everything feel not disappointed except for the person with time 5.

翻译中…

样例

Input #1
5
15 2 1 5 3
Output #1
4
InputCopy OutputCopy
题目信息
题号
545D
时间限制
1 s
内存限制
256 MB
标签
贪心
模拟
排序

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。