from math import *

H = int(eval(input()))

print((2**(int(log2(H))+1)-1))
print((2**int(eval(input())).bit_length()-1))
from math import *

H = int(eval(input()))
print((2 ** (int(log2(H)) + 1) - 1))

print((2 ** int(eval(input())).bit_length() - 1))

-from math import * - -H = int(eval(input())) -print((2 ** (int(log2(H)) + 1) - 1)) +print((2 ** int(eval(input())).bit_length() - 1))