A = int(input()) fp = [3,5,17,257,65537] ans = set() for i in range(1<<5): tmp = 1 for j in range(5): if i & (1< A: break for j in range(30): if tmp < 3: tmp *= 2 continue if tmp <= A: ans.add(tmp) else: break tmp *= 2 print(len(ans))