Because of the hardships the company has been facing recently, they ask you to help them optimize the staff. The company owners would like to only keep the employees who receive a relatively similar salary in a way that after the layoffs, the person earning the most would get at most twice the salary of the person earning the least.
You’d like to make sure the company keeps as much of its staff as possible. So, you start working on the problem right away.
The first line of the input contains a single integer
n(2 ≤ n ≤ ) the number of employees.
The next line contain
nspace-separated integers (1 ≤ ≤ ) the salaries of the employees.
The program should print the maximum number of employees it would be possible to keep.
4 4 3 2 4
6 5 4 3 3 7 8
- In the first example, it would be possible to keep all the employees. The minimum and maximum will be
4, and .
- In the second example, the company could keep the employees with salaries
5 4 3 3or
5 4 7 8. In both cases, there will be 4 employees left after the layoffs.