#K48957. Bacteria Doubling Steps
Bacteria Doubling Steps
Bacteria Doubling Steps
Consider a process where you start with 1 bacterium and the number of bacteria doubles in each step. For a given positive integer \(n\), determine the number of steps required to exactly reach \(n\) bacteria. In other words, find the non-negative integer \(k\) such that \(n = 2^k\). If such a \(k\) does not exist (i.e. if \(n\) is not a power of 2 or \(n < 1\)), output invalid input
.
For example, if \(n = 16\) then \(16 = 2^4\), so the required number of steps is 4.
inputFormat
Input is provided via standard input as a single integer (n).
outputFormat
Output the number of steps (an integer) required to reach (n) by repeatedly doubling the number starting from 1. If (n) is not a power of 2 or if (n < 1), output invalid input
.## sample
16
4