import math

i = int(eval(input()))

c = 1

while i > 1:

    i = i//2

    c += 1

print((2**c-1))
#D

import math

i = int(eval(input()))

low = 0

high = 45

for _ in range(100):

    l = 2**low

    h = 2**high

    m = 2**((low+high)/2)

    if i < m:

        high = (low+high)/2

    else:

        low = (low+high)/2

#print(low,high)

tmp = math.floor(high) + 1

print(((2**tmp)-1))
import math

i = int(eval(input()))
c = 1
while i > 1:
    i = i // 2
    c += 1
print((2**c - 1))

# D
import math

i = int(eval(input()))
low = 0
high = 45
for _ in range(100):
    l = 2**low
    h = 2**high
    m = 2 ** ((low + high) / 2)
    if i < m:
        high = (low + high) / 2
    else:
        low = (low + high) / 2
# print(low,high)
tmp = math.floor(high) + 1
print(((2**tmp) - 1))

+# D -c = 1 -while i > 1: -    i = i // 2 -    c += 1 -print((2**c - 1)) +low = 0 +high = 45 +for _ in range(100): +    l = 2**low +    h = 2**high +    m = 2 ** ((low + high) / 2) +    if i < m: +        high = (low + high) / 2 +    else: +        low = (low + high) / 2 +# print(low,high) +tmp = math.floor(high) + 1 +print(((2**tmp) - 1))