Tiger's engineering professor has given a surprise test to the entire class! For this test, students are given some tables and are required to build a tower using those tables.
The tower can be formed by stacking a table onto two other tables. If tables are viewed length-wise, 2 legs of the table are on one table below and the other 2 legs are on the other table below.
Each table has a weight of . The apparent weight is the amount of force required to lift the table. The four legs of the table evenly distribute the apparent weight onto some surfaces below.
Many of the available tables are questionable, so the table can only support an apparent weight of from the table legs above before collapsing.
Tiger wants to build the highest table tower that he can to impress his professor and the other students. Can you help him determine what that height will be?
Constraints
For all subtasks:
Subtask 1 [10%]
All values of are the same.
Subtask 2 [15%]
Subtask 3 [15%]
Subtask 4 [10%]
Subtask 5 [50%]
No additional constraints.
Input Specification
The first line contains .
The next line contains the integer .
The following line contains space-separated integers. The integer is .
It is guaranteed that in any non-collapsing tower, a table's apparent weight is always an integer.
Output Specification
The maximum height of a table tower. This is the number of layers in the largest table tower.
Sample Input
102
3
51 1 51
Sample Output
2
Comments