Problem:

Problem B: OOllOll

Problem

  非負整数$x$を2進数表記したときの各桁の和を$f(x)$とする。

  正整数$N$が与えられるので$f(0)$,$f(1)$,...,$f(N)$の中で最大のものを出力せよ。

  関数$f(5)$の計算の例:

  5を2進数表記すると101で各桁の和は1+0+1=2

  よって$f(5) = 2$となる。

  Note: https://ja.wikipedia.org/wiki/二進法

Input

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

$N$

正整数$N$が1行に与えられる。

Constraints

入力は以下の条件を満たす。

    
$1 \le N \le 10^9$

Ouput

$f(0)$,$f(1)$,...,$f(N)$の中で最大のものを1行に出力する。

Sample Input 1

2

Sample Output 1

1

Sample Input 2

9

Sample Output 2

3



Sample input:
2


Sample output:
1

Submission status: Wrong Answer

Solution code:
N = int(input())
x = 1
while 2*x+1 <= N:
    x = 2*x+1
print(x)

Submission status: Wrong Answer

Solution code:
N = int(input())
x = 1
while 2*x+1 <= N:
    x = 2*x+1
print(x)

Submission status: Wrong Answer

Solution code:
import math
print(int(math.log(int(input()), 2)))

Submission status: Wrong Answer

Solution code:
import math
print(math.floor(math.log(int(input()), 2)))

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
x = 1
while 2*x-1 <= N:
    x = 2*x
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
b = str(bin(N))[2:]
if all(c == '1' for c in b):
    print(len(b))
else:
    print(len(b)-1)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
def inpl(): return list(map(int, input().split()))
from math import log2

print(int(log2(int(input()) + 1)))

Submission status: Accepted

Solution code:
import math
print(int(math.log(int(input()) + 1, 2)))

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
tmp = 1
while tmp <= n+1 :
    tmp *= 2
    ans += 1
print(ans-1)

Submission status: Accepted

Solution code:
n = int(input())
a = bin(n)[2:]
if '0' in a:
    print(len(a)-1)
else:
    print(len(a))

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
s = 1
while 2 * s - 1 <= N:
    s *= 2
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
x = int(input())
ans = 0
i = 0
while (1 << i) <= x:
    if x & (1 << i):
        ans += 1
    i += 1
print(max(ans, i - 1))

Submission status: Accepted

Solution code:
import math
print((int)(math.log2(int(input())+1)))

Submission status: Accepted

Solution code:
N = format(int(input()), 'b')
print(len(N)-1 if '0' in N else len(N))

Submission status: Accepted

Solution code:
n = int(input())
ret = 0
bin_strlist = list(bin(n)) # 0b... ...のところに2進数の数字iの文字列が続く
bin_list = bin_strlist[2:]
if bin_list.count("0") == 0:
    print(len(bin_list))
else:
    print(len(bin_list)-1)

Submission status: Accepted

Solution code:
n = int(input())
cnt = 0
n += 1

while 1:
    n //= 2
    cnt += 1
    if n == 1:
        break

print(cnt)

Submission status: Accepted

Solution code:
from math import *
print(floor(log2(1+int(input()))))