n = bin(int(input()))
i = max = 0
for j in n:
if j == "1":
i += 1
if i > max:
max = i
if j == "0":
i = 0
print(max)
n = bin(int(input()))
i = max = 0
for j in n:
if j == "1":
i += 1
if i > max:
max = i
if j == "0":
i = 0
print(max)