Algorithms and Data Structures

Hide boxes

Given n boxes, you would like to hide as many of those boxes inside others as possible. There are several rules that you need to follow:
  1. You can place a small box inside of another larger box only if the larger one is at least twice as large as the small box.
  1. You can place only 1 box inside another box (No box can contain 2 or more other boxes).
notion image
What would be the minimum possible number of visible boxes in the end?

Input

The first line of the input contains a single integer n (1 ≤ n ≤ ) the number of boxes.
The next line contains n space-separated integers (1 ≤ ) the size of each box.

Output

The program should print the least possible number of visible boxes in the end.

Examples

Input
Output
8 7 5 2 6 4 8 9 2
5
8 3 1 8 2 6 5 6 9
5

Explanation

  1. 7 5 2 6 4 8 9 2 → (2, 5) (2, 6) (7) (4, 8) (9)
  1. 3 1 8 2 6 5 6 9 → 1 2 3 5 6 6 8 9 → (1, 5) (2, 6) (3, 6) (8) (9)
 

Constraints

Time limit: 0.2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue