n = int(input()) fs = [2**(2**a) + 1 for a in range(5)] count = 0 for used in range(2**5): cumf = 1 for f in fs: if used & 1: cumf *= f used >>= 1 pow2 = n // cumf while pow2: count += 1 pow2 >>= 1 print(count - 2)