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

print(~-(2 ** input().bit_length()))

-print((~-(2 ** int(eval(input())).bit_length()))) +print(~-(2 ** input().bit_length()))