a = int(input()) P = [1] while P[-1]*2 <= 10**9: P.append(P[-1]*2) F = [3, 5, 17, 257, 65537] ans = 0 for p in P: for i in range(1<<5): x = p for j in range(5): if (i>>j)&1: x *= F[j] if 3 <= x <= a: ans += 1 print(ans)