h = int(eval(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)))
h = int(eval(input()))



num = 1

count = 0

while h > 0:

    h = h//2

    count += num

    num = num*2

print(count)
h = int(eval(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)))

h = int(eval(input()))
num = 1
count = 0
while h > 0:
    h = h // 2
    count += num
    num = num * 2
print(count)

- - -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))) +num = 1 +count = 0 +while h > 0: +    h = h // 2 +    count += num +    num = num * 2 +print(count)