#K92192. Maximum Block Tower Height
Maximum Block Tower Height
Maximum Block Tower Height
You are given an integer n representing the maximum number of blocks you can use to build a tower. In addition, you are provided with a list of integers which correspond to available dimensions of blocks. Each block dimension can only be used once. The objective is to determine the maximum number of blocks you can stack under the constraint that each block must have a unique dimension.
The answer is given by the formula:
[ \min\Big(n, ; |{a_i}|\Big) ]
where \( n \) is the number of blocks you are allowed to use and \( |\{a_i\}| \) is the total number of unique block dimensions available.
inputFormat
The input is read from stdin and consists of two lines:
- The first line contains a single integer n representing the number of blocks you can use.
- The second line contains a space-separated list of integers representing the available block dimensions (Fibonacci numbers).
outputFormat
Output a single integer (printed to stdout) which is the maximum number of blocks that can be stacked under the given rules.
## sample5
1 2 3 5 8 13
5