Chang and the Mathematical Brainbuster
Practice
3.6 (5 votes)
Approved
Math
Medium
Open
Problem
89% Success 2457 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Chang loves solving mathematical puzzles. One day he was solving a puzzle. According to the problem statement of the puzzle: "there are N integers. you are asked to delete some numbers such that the series obtained after deletion follows the condition. (condition/equation): a - 3b<=0 where a is the maximum and b is the minimum of the series obtained after deletion is done. This condition/equation must be followed by the series of numbers obtained by deleting some numbers from original series of numbers". The question asks to tell the mininium number of integers to be deleted so that the above condition is followed by the remaining numbers obtained after deletion. Help chang in solving this mathematical brainbuster.

INPUT

The first line contain number of integers "N".The second line contains those N integers.

OUTPUT

output a single integer ie.the minimum number of integers needed to be removed to follow the condition.

Constraint

1 <= N <= 10^4
1 <= input number <= 10^4

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
2 votes
Tags:
AlgorithmsApprovedDynamic ProgrammingFenwick TreeMediumSegment TreesSorting
Points:30
5 votes
Tags:
Medium
Points:30
331 votes
Tags:
Medium