import sys

h=int(eval(input()))



n=0

while h>1:

    h=h // 2

    n+=1



a=1

for i in range(n):

    a=a*2+1

print(a)    
h=int(eval(input()))



def aaa(i):

    if i == 1:

        return(1)

    else:

        return 2*aaa(i//2)+1

print((aaa(h)))
import sys

h = int(eval(input()))
n = 0
while h > 1:
    h = h // 2
    n += 1
a = 1
for i in range(n):
    a = a * 2 + 1
print(a)

h = int(eval(input()))


def aaa(i):
    if i == 1:
        return 1
    else:
        return 2 * aaa(i // 2) + 1


print((aaa(h)))

-import sys +h = int(eval(input())) -h = int(eval(input())) -n = 0 -while h > 1: -    h = h // 2 -    n += 1 -a = 1 -for i in range(n): -    a = a * 2 + 1 -print(a) + +def aaa(i): +    if i == 1: +        return 1 +    else: +        return 2 * aaa(i // 2) + 1 + + +print((aaa(h)))