B - CTZ Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MB

配点 : 200

問題文

正の整数 X に対して、X2 進表記したときに 末尾 に連続する 0 の個数(の最大値)を \text{ctz}(X) で表します。
ただし、X2 進表記したとき末尾が 1 ならば \text{ctz}(X)=0 です。

正の整数 N が与えられるので、\text{ctz}(N) を出力してください。

制約

  • 1\leq N\leq 10^9
  • N は整数

入力

入力は以下の形式で標準入力から与えられる。

N

出力

\text{ctz}(N) を出力せよ。


入力例 1

2024

出力例 1

3

20242 進表記すると 11111101000 であり、末尾から 03 個連続しているため、\text{ctz}(2024)=3 です。
よって、3 を出力します。


入力例 2

18

出力例 2

1

182 進表記すると 10010 であるため、\text{ctz}(18)=1 です。
0 は末尾から連続する必要があることに注意してください。


入力例 3

5

出力例 3

0

Score: 200 points

Problem Statement

For a positive integer X, let \text{ctz}(X) be the (maximal) number of consecutive zeros at the end of the binary notation of X.
If the binary notation of X ends with a 1, then \text{ctz}(X)=0.

You are given a positive integer N. Print \text{ctz}(N).

Constraints

  • 1\leq N\leq 10^9
  • N is an integer.

Input

The input is given from Standard Input in the following format:

N

Output

Print \text{ctz}(N).


Sample Input 1

2024

Sample Output 1

3

2024 is 11111101000 in binary, with three consecutive 0s from the end, so \text{ctz}(2024)=3.
Thus, print 3.


Sample Input 2

18

Sample Output 2

1

18 is 10010 in binary, so \text{ctz}(18)=1.
Note that we count the trailing zeros.


Sample Input 3

5

Sample Output 3

0