#C7869. Minimum Number of Valves

    ID: 51787 Type: Default 1000ms 256MiB

Minimum Number of Valves

Minimum Number of Valves

You are given N plants, each requiring a specific volume of water. The water for each plant flows from a valve that can be split repeatedly. Every time you perform a split, the water flow is divided by 2. The number of splits required for a plant is equal to the exponent of 2 in its water requirement. For example, if a plant needs 16 units of water, then it requires \(16 = 2^4\), meaning 4 splits are required.

Your task is to determine the minimum number of valve splits needed so that every plant receives exactly its required volume of water. Note that this is equivalent to finding the maximum number of times 2 divides any of the water requirements.

inputFormat

The first line contains an integer \(N\), the number of plants. The second line contains \(N\) space-separated positive integers, where the \(i\)th integer indicates the water requirement for the \(i\)th plant.

outputFormat

Output a single integer, representing the minimum number of valve splits required.

## sample
5
2 2 4 8 16
4

</p>