h=int(eval(input()))





t=0

while h!=1:

    # print(h)

    h//=2

    t+=1

    



print((2**t*2-1))
h=int(eval(input()))

def f(x):

  if x==1:

    return 1

  return f(x//2)*2



ans=f(h)

print((ans*2-1))
h = int(eval(input()))
t = 0
while h != 1:
    # print(h)
    h //= 2
    t += 1
print((2**t * 2 - 1))

h = int(eval(input()))


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


ans = f(h)
print((ans * 2 - 1))

-t = 0 -while h != 1: -    # print(h) -    h //= 2 -    t += 1 -print((2**t * 2 - 1)) + + +def f(x): +    if x == 1: +        return 1 +    return f(x // 2) * 2 + + +ans = f(h) +print((ans * 2 - 1))