x = [3, 5, 17, 257, 65537] a = int(input()) s = 0 for i in range(30): for j in range(32): m = 1 << i if j & 1: m *= x[0] if j & 2: m *= x[1] if j & 4: m *= x[2] if j & 8: m *= x[3] if j & 16: m *= x[4] if m > 2 and m <= a: s += 1 print(s)