The most significant bit
Given an integer
n
, you are asked to calculate its most significant bit and print the corresponding power of 2. Input
The input contains a single integer
n
(1 ≤ n ≤ ). Output
The program should print the index of the most significant bit and the corresponding power of 2 separated by a space. The indexing starts at 0.
Examples
Input | Output |
9 | 3 8 |
311 | 8 256 |
Explanation
- 9 → 1001 ⇒ the index is 3 and the power of 2 is 8
- 311 → 100110111 ⇒ the index is 8 and the power of 2 is 256
Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 1 MB