from bisect import bisect_right F = [3, 5, 17, 257, 65537] f = len(F) ANS = [] for bit in range(1 << f): res = 1 for i in range(f): if (bit >> i) & 1: res *= F[i] if res == 1: res = 4 while res <= 10**9: ANS.append(res) res *= 2 ANS.sort() n = int(input()) print(bisect_right(ANS, n))