Problem:
 Score : 400 points    Problem Statement Caracal is fighting with a monster.  The health of the monster is H .  Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens:   If the monster's health is 1 , it drops to 0 .  If the monster's health, X , is greater than 1 , that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor .   ( \lfloor r \rfloor denotes the greatest integer not exceeding r .)  Caracal wins when the healths of all existing monsters become 0 or below.  Find the minimum number of attacks Caracal needs to make before winning.      Constraints  1 \leq H \leq 10^{12}  All values in input are integers.         Input Input is given from Standard Input in the following format:  H       Output Find the minimum number of attacks Caracal needs to make before winning.        Sample Input 1 2      Sample Output 1 3  When Caracal attacks the initial monster, it disappears, and two monsters appear, each with the health of 1 .  Then, Caracal can attack each of these new monsters once and win with a total of three attacks.       Sample Input 2 4      Sample Output 2 7       Sample Input 3 1000000000000      Sample Output 3 1099511627775

Solution (Python):

class abc_153:
    
    def __init__(self):
        pass
    def A(self):
        pass
    def B(self):
        pass
    def C(self):
        pass
    def D(self):
        H=int(input())
        count=1
        att_count=0
        
        while H>0:
            att_count+=count
            count*=2
            H>>=1
        print(att_count)
        
    def E(self):
        pass
    def F(self):
        pass
    
if __name__=='__main__':
    obj=abc_153()
    obj.D()

Solution (Python):
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


sys.setrecursionlimit(10**5)


def main():
    h = gete(int)

    def dfs(x):
        if x == 1:
            return 1
        else:
            return 1 + 2 * dfs(x // 2)

    print(dfs(h))


if __name__ == "__main__":
    main()

Solution (Python):
h = int(input())
i=1
while 2**i - 1 <h:
   i+=1
print(2**i - 1)

Solution (Python):
H = int(input()) 

def attack(H):
    if H==1:
        return 1
    else:
        return 2*attack(H//2)+1

print(attack(H))

Solution (Python):
H = int(input())
cnt = 0
while True:
    H //= 2
    cnt += 1
    if H == 0:
        break

print(2**cnt - 1)

Solution (Python):
def main():
    h = int(input())

    if h == 1:
        print(1)
        exit()

    for i in range(40):
        if 2**(i+1) == h:
            n = i+2
            break
        if 2**(i) < h and h < 2**(i+1):
            n = i+1
            break
    ans = sum([2**i for i in range(n)])
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
h = int(input())

ans = 0

cnt = 1

while h != 0:
    h = h//2
    ans += cnt
    cnt *= 2
    
print(ans)

Solution (Python):
H=int(input())

def touhisum(a, r, n):
    return int(a*(r**n-1)/(r-1))

import math

kaiso=int(math.log2(H))+1

print(touhisum(1,2,kaiso))

Solution (Python):
import math
n=int(input())
n=int(math.log2(n))
ans=2**(n+1)
print(ans-1)

Solution (Python):
h=int(input())
cnt = 0
while h > 0:
  cnt+=1
  h//=2
print(pow(2,cnt)-1)

Solution (Python):
import sys

input = lambda: sys.stdin.readline().rstrip()


def solve():
    H = int(input())

    bin_k = 0
    tmp = H
    while True:
        bin_k += 1
        tmp = tmp // 2
        if tmp == 0:
            break

    ans = 0
    for i in range(bin_k):
        ans += 2 ** i

    print(ans)


if __name__ == '__main__':
    solve()

Solution (Python):
import math
def main():
    H = int(input())
    
    
    
    
    
    
    k = int(math.log(H)/math.log(2))
    ans = 1
    tmp = 1
    for i in range(k):
        tmp *= 2
        ans += tmp
    print(ans)

main()

Solution (Python):
n = int(input())
count = 1
while(n):
	count *= 2
	n //= 2
print(count - 1)

Solution (Python):

h = int(input())



if h == 1:
  print(1)
  exit()

for i in range(1, 41):
  h //= 2
  if h == 1:
    print(2 ** (i + 1) - 1)
    exit()

Solution (Python):
H = int(input())

def rec(x):
    if x == 1: return 1
    a = rec(x//2)
    return a*2 + 1
 
print(rec(H))

Solution (Python):
import math
h = int(input())
tmp = int(math.log2(h))
print(2**(tmp+1)-1)

Solution (Python):
h = int(input())

def f(x):
    if x == 1: return 1
    a = f(x//2)
    return a*2 + 1

print(f(h))

Solution (Python):
h = int(input())

for i in range(h):
    if 2**i <= h and h < 2**(i+1):
        a = i
        break

ans = 1
for i in range(a):
    ans = ans * 2 + 1

print(ans)

Solution (Python):


def solve():
    H = int(input())

    memo = {}
    def dfs(h):
        if h in memo:
            return memo[h]
        if h == 1:
            memo[1] = 1
            return 1

        ret1 = dfs(h//2)
        ret2 = dfs(h//2)
        memo[h] = ret1 + ret2 + 1
        return memo[h]

    ans = dfs(H)
    print(ans)


if __name__ == "__main__":
    solve()

Solution (Python):
N=int(input())

cnt=0
tmp=N
for i in range(100):
    if tmp==1:
        break
    else:
        tmp=tmp//2
        cnt+=1
print(2**(cnt+1)-1)

Solution (Python):
H = int(input())
ans = 0

l = []
n = 1

while n <= H:
    l.append(n)
    n *= 2
print(sum(l))

Solution (Python):
H = int(input())

hp = H
count = 0
while hp > 1:
    hp = hp // 2
    count += 1
    
ans = 0
for i in range(count):
    ans += 2 ** i
    
ans += 2 ** count
print(ans)

Solution (Python):
def fun(N):
	if(N == 1):
		return 1;
	return 2*fun(N//2)+1

n = int(input())
print(fun(n))

Solution (Python):
H = int(input())
def f(n):
    if n == 1:
        return 1
    else:
        return 1 + f(n // 2) * 2
print(f(H))

Solution (Python):
H = int(input())
count = 1
monster = 1
while True:
  if H == 1:
    break
  else:
    H = int(H / 2)
    monster = monster * 2
    count += monster
print(count)

Solution (Python):

def main():
    H  = int(input()) 
    kazu = 1
    cnt = 0
    while H!=1:
        cnt += (kazu)
        kazu = kazu * 2
        H = H//2
    print(cnt+kazu)




if __name__ == '__main__':
    main()

Solution (Python):

H = int(input())
m = 1
c = 0
while H > 0:
    c += m
    m *= 2
    H //= 2
print(c)

Solution (Python):
import bisect
H = int(input())

two = [2**i for i in range(40)]
ix = bisect.bisect_right(two, H)

ans = 0
for i in range(ix):
    ans += two[i]
print(ans)

Solution (Python):
print(2 ** int(input()).bit_length() - 1)

Solution (Python):
h=int(input())
a=0
b=0
if h%2 != 0:
	h=h-1
c=h
while h > 1:
	h=int(h/2)
	a+=1

for i in range(a):
	b+=2**i
print(2**a+b)

Solution (Python):
h = int(input())
ans = 1
while h >= ans:
    ans *= 2
print(ans - 1)

Solution (Python):
def main():
    h = int(input())
    count = 0
    while h != 0:
        count += 1
        if h == 1:
            h = 0
        else:
            h //= 2
    print(2**count-1)
    
if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
ans = 0
for i in range(10**10):
    a = 2**i
    ans += a
    if a >= n:
        if a > n:
            ans -= a
        print(ans)
        break

Solution (Python):
H = int(input())
m = 1
at = 0
for i in range(H):
    if H == 1:
        at += m
        print(at)
        exit()
    at += m
    H //= 2
    m *= 2

Solution (Python):
h = int(input())
attack = 0
monster = 1
while True :
    attack += monster
    monster = monster * 2
    h = h//2
    if (h == 0) :
        print(attack)
        exit()

Solution (Python):
import math
h = int(input())
ans = 1

for i in range(1,int(math.sqrt(10**12))):
    if  h > ans:
        ans+= 2**i
    else:
        break
print(ans)

Solution (Python):
h=int(input())




i=0
count=1
while h>1:
    i+=1
    count+=2**i
    h=h//2

print(count)

Solution (Python):
H = int(input())
from math import log, floor

N = floor(log(H)/log(2)) + 1
print(2**N-1)

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from math import log2
from math import floor
def main():
    H = int(readline())
    print(2**(floor(log2(H))+1)-1)
if __name__ == '__main__':
    main()

Solution (Python):
h = int(input())
def attack(h):
    count = 0
    if h == 1:
        count += 1
        return count
    else:
        count += 1
        count += 2*attack(h//2)
        return count

print(attack(h))

Solution (Python):

H = int(input())
c = 0
n = 0
while H > 1:
    c += 1
    H = int(H / 2)
print(2 **(c + 1) - 1)

Solution (Python):
n = int(input())
n_o = n
count = 0
for i in range(1,100):
    n = n // 2
    count = count + 1
    if n <= 1:
        break
if n_o == 1:
    print(1)
else:
    print(2**(count+1)-1)

Solution (Python):
h = int(input())

def f(x):
  if x == 1:
    return 1
  else:
    return 2*f(x//2)+1
    
print(f(h))

Solution (Python):
H = int(input())

ans = 0
i = 0
h = H
while (h > 0):
    ans += 2 ** i
    i += 1
    h = int(h / 2)
print(ans)

Solution (Python):
N = int(input())
count = 0
while N != 0:
    N //= 2
    count += 1
print((2**count-1))

Solution (Python):
H=int(input())
K=1

while not K <= H < 2*K:
  K = 2*K

print(2*K-1)

Solution (Python):
h=int(input())
ans=0
monster=1
import math
while h>0:
  ans+=monster
  h=math.floor(h/2)
  monster*=2
print(ans)

Solution (Python):

def inp():
    return(int(input()))


n = inp()
i = 1
while n > 1:
    n = int(n/2)
    i += 1
print(2**i - 1)

Solution (Python):
h = int(input())
n = 0
while h>1:
  h = h//2
  n += 1
print(2**(n+1)-1)

Solution (Python):
h = int(raw_input())

def f(h):
	if h == 1:
		return 1
	return 1 + 2 * f(h/2)

print f(h)

Solution (Python):
h=int(input())

def rec(h):
    if h==1:
        return 1
    else:
        return 2*rec(h//2)+1
print(rec(h))

Solution (Python):
import math
from collections import deque
from collections import defaultdict


def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): 
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): 
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} 
def bitArr(n):
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): 
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq

h = readInt()

ans=0
count = 0
while h!=1:
	h=h//2
	count+=1

print(2**(count+1)-1)

Solution (Python):
H = int(input())
r = 0
n = 1
h = H
while h > 0:
  r += n
  if h > 1:
    n = 2*n
    h = h//2
  elif h == 1:
    h = 0
print(r)

Solution (Python):
import math
H = int(input())
ans = 0
i = 1
while H>0:
  H=math.floor(H/2)
  ans += i
  i=i*2

print(ans)

Solution (Python):
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

h = ni()



def atk(n):
  if n==0:
    return 1

  n //=2
  return atk(n)*2

print(atk(h)-1)

Solution (Python):
m = int(input())
i = 0
count = 0
while 2**i <= m:
    count += 2**i
    i += 1

print(count)

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 9)
h=int(input())
def func(i):
  if i==1:
    return 1
  else:
    return func(i//2)*2+1
print(func(h))

Solution (Python):


def main():
    H = int(input())
    cnt = 1; ans = 1
    while H > 1:
        cnt = cnt*2
        ans += cnt
        H = H//2
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
from math import log2
h = int(input())
print(2 ** int(log2(h) + 1) - 1)

Solution (Python):
h = int(input())
cnt = 0
ans = 0
while h > 0:
    h //= 2
    ans += pow(2, cnt)
    cnt += 1
print(ans)

Solution (Python):
H=int(input())
cnt=0
for i in range(1,10**9):
    if H>1:
        H=H//2
        cnt+=1
    elif H==1:
        cnt+=1
        break
print(2**cnt-1)

Solution (Python):
H=int(input())
count=1
ans=0
if H==1:
    print(1)
    exit()
while H//2!=1:
    count+=1
    H=H//2
for i in range(0,count+1):
    ans+=2**i
print(ans)

Solution (Python):
H = int(input())

depth = 0
while H > 1:
    H = H // 2
    depth += 1

answer = 0
for i in range(0, depth+1):
    answer += pow(2, i)

print(answer)

Solution (Python):
h=int(input())
r=1
n=1
import math
while h>1:
  h=math.floor(h/2)
  n*=2
  r+=n
print(r)

Solution (Python):
enemie = int(input())

def attack(N, times=-1):
    times += 1
    if N // 2 == 0:
        return times
    else:
        enemie = N // 2
        return attack(enemie, times)

ans = 0
for i in range(attack(enemie)+1):
    ans += 2**i

print(ans)

Solution (Python):
enemie = int(input())

times = -1
for i in range(enemie):
    times += 1
    if enemie >= 2:
        enemie //= 2
    else:
        break

ans = 0
for j in range(times+1):
    ans += 2**j
    
print(ans)

Solution (Python):
enemie = int(input())

times = 0
for i in range(enemie):
    times += 1
    if enemie >= 2:
        enemie //= 2
    else:
        break

ans = 0
for j in range(times):
    ans += 2**j
    
print(ans)

Solution (Python):
h = int(input())
def monster(h):
  if h == 1:
    return 1
  return monster(int(h/2))*2+1
print(monster(h))

Solution (Python):
h = int(input())
def monster(h):
  if h == 1:
    return 1
  return monster(int(h/2))*2+1
print(monster(h))

Solution (Python):
H=int(input())

ans=0
c=1
while(H>=1):
    H//=2
    ans+=c
    c*=2
print(ans)

Solution (Python):
H = int(input())
print(2 ** (H.bit_length()) - 1)

Solution (Python):
H = int(input())

ans = 0
num = 0

while(H > 0):
    ans += 2 ** num
    num += 1
    H //= 2

print(ans)

Solution (Python):
h = int(input())
f = True
count = 0
while f:
    if 2**count<= h < 2**(count+1):
        f = False
    else:
        count += 1

ans = 0
for i in range(count):
    ans += 2**i

print(ans+2**count)

Solution (Python):
import sys
import math
from collections import deque
from collections import defaultdict

def main():
    h = int(sys.stdin.readline())
    time = 0
    while(h != 0):
        h = h // 2
        time += 1
    print(pow(2,time)-1)
    return 0

if __name__ == "__main__":
    main()

Solution (Python):
H=int(input())

total=0
for i in range(10**2):
    H=int(H/2)
    if H>=1:
        total+=1
    else:
        break
attack=0
for i in range(total+1):
    attack+=2**(total-i)
print(attack)

Solution (Python):
h = int(input())
count = 0
def sum(n):
    ans = 0
    for i in range(1,n+1):
        ans += 2**i
    return ans
while h > 1:
    h = h // 2
    count += 1
print(sum(count)+1)

Solution (Python):
def func(x):
    if x > 1:
        return 2 * func(x//2) + 1
    elif x == 1:
        return 1


H = int(input())

ans = func(H)
print(ans)

Solution (Python):
H = int(input())

bi = bin(H)
bi2 = bi[2:]
ans = 2**len(bi2) - 1
print(ans)

Solution (Python):
h = int(input())

step = 1
cnt = 0
while h > 0:
    h //= 2
    cnt += step
    step *= 2

print(cnt)

Solution (Python):
import math
A = int(input())
ans = 0
i = 1

while A > 1:
  A = math.floor(A/2)
  ans += i
  i *= 2


ans += i
print(ans)

Solution (Python):
H = int(input())
cnt = 0
tmp = 1
while H != 1:
    H = H // 2
    cnt += tmp
    tmp *= 2
cnt += tmp
print(cnt)

Solution (Python):
import sys
import math
input = sys.stdin.readline


def main():
    H = int(input())
    print(sum([2**i for i in range(math.floor(math.log2(H)+1))]))


if __name__ == '__main__':
    main()

Solution (Python):
h=int(input())
t=0
for i in range(41):
    if(2**i>h):
        t=i
        break
ans=0
for i in range(t):
    ans+=2**i
print(ans)

Solution (Python):
h = int(input())

add = 1
ans = 0
while(h!=1):
    h = h//2
    ans += add
    add *= 2
    
ans += add
print(ans)

Solution (Python):
H=int(input())

deep=0
count=0
while(H>=1):
  H=H//2
  count+=2**deep
  deep+=1

print(count)

Solution (Python):
H = int(input())

count = 0
monster_num = 1
monster_hp = H
while monster_hp != 0:
    count += monster_num
    monster_num *= 2
    monster_hp //= 2
print(count)

Solution (Python):
import math 
import sys 

t=1
for _ in range(t):
    n=int(input())
    x=0
    ans=0
    while(n>0):
        n//=2
        ans+=2**x 
        x+=1
    print(ans)

Solution (Python):
H  = int(input())

i = 0
ans = 0

while H != 1:
  H = int(H//2)
  i += 1

for i in range(1,i+1):
  ans += 2**i
  
print(ans+1)

Solution (Python):
import sys
import math
import bisect
import re

d = dict()

def solve(n):
    global d
    if n not in d:
        if n == 1:
            d[n] = 1
        else:
            d[n] = 1 + 2 * solve(n // 2)
    return d[n]

def main():
    n = int(input())
    print(solve(n))

if __name__ == "__main__":
    main()

Solution (Python):
import math

h = int(input())
t = int(math.log2(h))
a = 2**(t+1)
print(a-1)

Solution (Python):
H = int(input())

count = 0
cnt = 1
while H > 0:
    count += cnt
    cnt = cnt*2
    H = int(H/2)
print(count)

Solution (Python):
h = int(input())
cnt = 1
while h>1:
    h = int(h/2)
    cnt = cnt + 1
print((2**cnt)-1)

Solution (Python):

h = int(input())


curr_2_njou = 1
while True:
    if h < curr_2_njou:
        break
    else:
        curr_2_njou*=2

print(curr_2_njou-1)

Solution (Python):
h = int(input())
a = 0
kaisuu = 0
for i in range(50):
    if 2**(i)<=h and h <2**(i+1):
        a = i
        kaisuu += 2**i
        break
    else:
        kaisuu += 2**i
print(kaisuu)

Solution (Python):
hp_init = int(input())
hp = hp_init
num = 1
ans = 0

while hp > 0:
    ans += num
    hp //= 2
    num *= 2

print(ans)

Solution (Python):
def f(h):
    return 0 if h==0 else 1 + 2*f(int(h/2))

h = int(input())
print(f(h))

Solution (Python):
import math

h = int(input())

ans = 0
add_v = 1

while True:
    if h < 1:
        break
    h = math.floor(h / 2)
    ans += add_v
    add_v *= 2
print(ans)

Solution (Python):
import math
def py():
    print("yes")
def pn():
    print("no")
def iin():
    x = int(input())
    return x

neko = 1
nya = 1
nuko = 0

h = iin()
while h > 1:
    h //= 2
    neko += 1
print(2**neko-1)

Solution (Python):
H=int(input())
n=0
while H!=1:
  H=int(H/2)
  n+=1
print(2**(n+1)-1)

Solution (Python):
import math
H = int(input())
a = int(math.log2(H))
print((pow(2, a+1)-1))

Solution (Python):
h=int(input())
i=1
t=0
while h>0:
   t+=i
   i=i*2
   h=int(h/2)
print(t)

Solution (Python):
h = int(input())
ans = 1
while h > 0:
  h = h // 2
  ans *= 2
print(ans - 1)

Solution (Python):
import sys

input = sys.stdin.readline

def main():
    n = int(input())
    i = 0
    while n > 0:
        i += 1
        n //= 2

    print(2**i - 1)

if __name__ == '__main__':
    main()

Solution (Python):
H=int(input())
ans=1
while H>0:
  H=H//2
  ans*=2
print(ans-1)

Solution (Python):
H = int(input())

ans = H
cnt = 1

def attack(h, ans, cnt):
    if h==1:
        return(ans)
    else:
        if h%2==0:
            ans += (1*cnt)
        h = h//2
        cnt *= 2
        return attack(h, ans, cnt)

ans = attack(H, ans, cnt)

print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10**6)

H = int(input())
def attack_count(X):
    if X == 1:
        return 1
    return 1+2*attack_count(X//2)

print(attack_count(H))

Solution (Python):
import math
H=int(input())
a=H
ans=1
while a>1:
  a=math.floor(a/2)
  ans+=1
Ans=2**(ans)
print(Ans-1)

Solution (Python):
H = int(input())

n = 0
A = 0
while H:
    if H == 1:
        A += 2**n
        break
    H //= 2
    A += 2**n
    
    n += 1
    
    

print(A)

Solution (Python):
import math
h = int(input())
print(2**(1 + int(math.log2(h))) - 1)

Solution (Python):
H = int(input())
i = 0
while 2 ** i <= H:
    i += 1
ans = 2 ** i - 1
print(ans)

Solution (Python):
H=int(input())

ans=0
n=1
while H>1:
    H//=2
    ans+=n
    n*=2
ans+=n
print(ans)

Solution (Python):
import fractions
power = int(fractions.math.log2(int(input())))
ans = 0
for p in range(power+1):
  ans += 2**p
print(ans)

Solution (Python):
H = int(input())
count = 0
atack = 0
while True:
    H = int(H/2)
    atack += 2**count
    count += 1
    if H<=0:
        break
print(atack)

Solution (Python):
def resolve():
    from functools import lru_cache
    n = int(input())

    @lru_cache(maxsize=1000)
    def attack(i):
        if i == 1:
            return 1
        else:
            return 1 + attack(i // 2) + attack(i // 2)

    print(attack(n))


resolve()

Solution (Python):
H = int(input())
i = 0
k = 0

while H>=1 :
    H = H//2
    i += 2**k
    k += 1 

print(i)

Solution (Python):
h=int(input())
ans=0
number=1
while h>0:
    h=h//2
    ans=ans+number
    number=number*2
print(ans)

Solution (Python):
import math

h = int(input())
n = math.floor(math.log(h , 2))

print(2 ** (n + 1) - 1)

Solution (Python):
H=int(input())
counter=0
while H>1:
    H=H//2
    counter+=1
ans=0
for i in range(counter+1):
    ans+=2**i
print(ans)

Solution (Python):
h = int(input())

num = 0
plusvalue = 1
while True:
    if h % 2 == 1:
        h -= 1
    h //= 2
    num += plusvalue
    plusvalue *= 2
    if h == 0:
        break
print(num)

Solution (Python):
h=int(input())
count=0
i=0
while h>1:
    i+=1
    h=int(h/2)
    count+=2**i
print(count+1)

Solution (Python):
h=int(input())
count=0
i=0
while h>1:
    i+=1
    h=int(h/2)
    count+=2**i
print(count+1)

Solution (Python):
h=int(input())

for i in range(50):
    if 2**i <= h and h < 2**(i+1):
        print(2**(i+1)-1)

Solution (Python):
H = int(input())

a = [1]
for i in range(1, 41):
    a.append(a[i-1]*2 + 1)


for k in range(41):
    if 2**k <= H and H < 2**(k+1):
        print(a[k])
        break

Solution (Python):
H = int(input())

def calculate(h):
    if h == 1:
        return 1
    return 1 + 2*calculate(h//2)


result = calculate(H)

print(result)

Solution (Python):
import math

def attack(x):
    if x == 1:
        return 1
    else:
        return 1 + 2 * attack(math.floor(x / 2))

h = int(input())
print(attack(h))

Solution (Python):
h = int(input())
ans = 0
count = 1
while ans == 0:
    if h < 2 ** count:
        ans = 2 ** count - 1
    count += 1
print(ans)

Solution (Python):
hp = int(input())
monster = 1
count = 0
while monster > 0:
    if hp == 1:
        count += monster
        break
    else:
        hp = hp // 2
        count += monster
        monster *= 2

print(count)

Solution (Python):
import sys

input = sys.stdin.readline


def main():
    H = int(input())

    n = 0
    ans = 0
    while H > 0:
        H //= 2
        ans += 2 ** n
        n += 1

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
H = int(input())
n = len(bin(H)) - 2
print(2 ** n - 1)

Solution (Python):
n = int(input())

cnt = 1
res = 1
while n != 1:
    n = n // 2
    cnt = cnt*2
    res += cnt
print(res)

Solution (Python):
N = int(input())

s = 0
while N >= 1:
    N = N//2
    s += 1
t = 0
for i in range(s):
    t = t + 2**i
print(t)

Solution (Python):
import math

h = int(input())

n = int(math.log(h,2))

ans=0
for i in range(n+1):
    ans += 2**i
print(ans)

Solution (Python):

"""
Created on Fri May  8 15:34:23 2020

@author: shinba
"""

h = int(input())

cnt = 1

while h > 1:
    h //= 2
    cnt += 1

print(2**cnt-1)

Solution (Python):
def aaa():
    a=int(input())
    count=0
    at=1
    while a>0:
        a//=2
        count+=at
        at*=2
    print(count)

if __name__=='__main__':
    aaa()

Solution (Python):
from sys import stdin, setrecursionlimit


def main():
    h = int(stdin.readline())

    ans = 0

    while 2 ** (ans + 1) <= h:
        ans += 1

    print(2 ** (ans + 1) - 1)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Solution (Python):
h = int(input())

ans = 1
while True:
  if h<ans:
    break
  ans*=2
print(ans-1)

Solution (Python):
def main():
    h=int(input())
    ans=0
    tmp=1
    while h>0:
        h//=2
        ans+=tmp
        tmp*=2
    print(ans)
    
if __name__ == '__main__':
    main()

Solution (Python):
import math
H = int(input())
m = int(math.log2(H))
cnt = sum([2 ** i for i in range(m+1)])
print(cnt)

Solution (Python):
def half(n):
    if n == 1:
        return 1
    else:
        new_n = n // 2
        return half(new_n)*2 + 1

h = int(input())

print(half(h))

Solution (Python):
import math
H = int(input())
n = int(math.log(H,2))
print(pow(2,n+1)-1)

Solution (Python):
h = int(input())

num = 0
n = 0

while h > 0:
    h //= 2
    num += 2 ** n
    n += 1
print(num)

Solution (Python):
h = int(input())

cnt = 0
while True:
    cnt += 1
    if h == 1:
        break
    h = h // 2

result = 0
for i in range(cnt):
    result += 2**i
print(result)

Solution (Python):
import sys
from io import StringIO
import unittest


def calc(h):
    if h == 1:
        return 1
    else:
        return 2 * calc(h//2) + 1

def resolve():
    h = int(input())
    print(calc(h))


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """2"""
        output = """3"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """4"""
        output = """7"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """1000000000000"""
        output = """1099511627775"""
        self.assertIO(input, output)


if __name__ == "__main__":
    
    resolve()

Solution (Python):
N = int(input())
count=1
while N > 1:
  count += 1
  N //= 2
print(2**count -1)

Solution (Python):
H = int(input())
import math

h = H
enemies = 0
counter = 0

while h >= 1:
    counter = counter + 1
    h = h//2

print(2**counter - 1)

Solution (Python):
x = int(input())

Sum = 1
tmpn = 1
while x != 1:
  tmpn *= 2
  Sum += tmpn
  x = int(x/2)

print(Sum)

Solution (Python):


H = int(input())

def attack_cnt(h):
    if h == 1:
        return 1
    return 2 * attack_cnt(h // 2) + 1

print(attack_cnt(H))

Solution (Python):


H = int(input())

cnt = 0
i = 0
while True:
    cnt += 2 ** i
    i += 1
    if H < 2 ** i:
        break

print(cnt)

Solution (Python):
import math
h = int(input())
temp = 1
ans = 0


def calc(x):
    a = math.floor(x / 2)
    return a


if (h == 1):
    print('1')
else:
    while (h >= 1):
        h = calc(h)
        ans += temp
        temp *= 2
    print(ans)

Solution (Python):
H = int(input())
h = 0
while H >= 2:
    h += 1
    H = H // 2
print(2**(h+1)-1)

Solution (Python):
h = int(input())

def func(x):
    if x == 1:
        return 1
    else:
        a = func(x//2)
        return a*2+1

print(func(h))

Solution (Python):
h = int(input())

ans = 0
x = 0

def dfs(h,x):
    global ans
    if h == 1:
        ans += 2**x
        return
    else:
        ans += 2**x
        h //= 2
        x += 1
        dfs(h, x)
        
dfs(h,x)

print(ans)

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
import sys
def I(): return int(input())  
def Is(): return map(int, input().split())  
def LI(): return list(map(int, input().split()))  
def TI(): return tuple(map(int, input().split()))  
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()  
def LS(): return list(input())  
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(1000000)
MOD = 1000000007
INF = float('inf')

h = I()
mul = 1
ans = 0
while h > 0:
    h = floor(h/2)
    ans += mul
    mul *= 2

print(ans)

Solution (Python):
HP = int(input())
if HP == 1:
  print("1")

else:
  
  print(pow(2,len(bin(HP))-2)-1)

Solution (Python):
h = int(input())

count = 0
while h != 0:
    h = int(h/2)
    count += 1

ans = 0
for i in range(count):
    ans += 2**i
  
print(ans)

Solution (Python):
h = int(input())
def a(n):
  if n==1:
    return 1
  else:
    return a(n//2)*2+1

print(a(h))

Solution (Python):
h = int(input())
s = 1
while h!=1:
  h //=2
  s += 1
print(2**s-1)

Solution (Python):
h = int(input())
hits = 0
mons = 1
while h>0:
  if h==1:
    hits += mons
    h=0
  else:
    hits += mons
    mons *= 2
    h = h//2
print(hits)

Solution (Python):
H = int(input())

for i in range(40):
  if 2 ** i <= H < 2 ** (i + 1):
    print((2 ** (i + 1) - 1)) 
    exit()

Solution (Python):
H = int(input())
count = 0
while H != 1:
    H //= 2
    count += 1

A = 0
for a in range(count):
    A += 2 ** a

result = 2 ** count + A
print(result)

Solution (Python):
h=int(input()).bit_length()
print(2**h-1)

Solution (Python):
h = int(input())
i = 0
ans = 0
while h > 0:
    ans += 2**i
    i += 1
    h //= 2
print(ans)

Solution (Python):
h=int(input()).bit_length()
print(2**h-1)

Solution (Python):
h = int(input())
i = 0
def yamamoto(x):
    return int(x / 2)
while h > 0:
    h = yamamoto(h)
    i = i * 2 + 1
print(i)

Solution (Python):
import math

h = int(input())

def f(hp):
    if(hp == 1):
        return 1
    else:
        return (2 * f(math.floor(hp / 2)) + 1)

print(f(h))

Solution (Python):
h=int(input())
a=1

if h ==1:
 print(1)
else:
 while True:
  h=h//2
  a+=1
  if h//2==0:
   break

 print(2**a-1)

Solution (Python):
import sys
h = int(input())
i = 0
j = 0
while h !=1:
    h = int(h/2)
    j += 2**i
    i += 1
print(j+2**i)

Solution (Python):
h = int(input())

ans = 1
c = 0
while(h>0):
    h//=2
    
    c+=ans
    ans*=2
print(c)

Solution (Python):
H=int(input())

def time(h):
  if h==1:
    return 1
  else:
    return time(h//2)*2 + 1
print(time(H))

Solution (Python):
H=int(input())
i=0
c=0

while H>=2**i:
  if H<2**(i+1):
    break
  else:
    i+=1
  
for j in range(i+1):
  c+=2**j

  
print(c)