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()))

def atk(n):

  if n==1:

    return 1

  return 1+2*(atk(n//2))

print((atk(h)))
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()))


def atk(n):
    if n == 1:
        return 1
    return 1 + 2 * (atk(n // 2))


print((atk(h)))

-def f(x): -    if x == 1: +def atk(n): +    if n == 1: -    return f(x // 2) * 2 +    return 1 + 2 * (atk(n // 2)) -ans = f(h) -print((ans * 2 - 1)) +print((atk(h)))