import itertools l = [3, 5, 17, 257, 65537] l1 = [1] + l for i in range(2, 6): y = list(itertools.combinations(l, i)) for j in y: x = 1 for k in j: x *= int(k) l1.append(x) l2 = [] for i in range(30): l2.append(2**i) ans = l1 + l2 for i in l1: for j in l2: ans.append(i * j) ans = sorted(set(ans)) a = int(input()) ans = [i for i in ans if 2 < i <= a] print(len(ans))