#P11125. Determining Time for Exact Colony Size

    ID: 13185 Type: Default 1000ms 256MiB

Determining Time for Exact Colony Size

Determining Time for Exact Colony Size

The colony size is defined as the total number of bacteria in a petri dish. Initially, at time 0 seconds, the colony contains 1 bacterium. Every second, each bacterium divides, doubling the total number. Thus, at time t, the colony size is given by the formula $$ N(t)=2^t. $$

The goal of the experiment is to determine the first time (in seconds) at which the colony size is exactly equal to a given integer \(m\). If it is impossible for the colony to have exactly \(m\) bacteria at any moment, output -1.

Note: Since the colony size follows an exponential growth pattern (1, 2, 4, 8, ...), it will be exactly equal to \(m\) if and only if \(m\) is a power of two.

inputFormat

A single line containing one integer (m) (1 (\le) m (\le) 10^18) representing the target colony size.

outputFormat

Output a single integer: the number of seconds it takes for the colony size to exactly reach (m). If it is never possible, output -1.

sample

1
0