a = int(input()) lst = [2, 3, 5, 17, 257, 65537] ans = 0 def dfs(p, c): if p == 6: global ans ans += 1 return if p == 0: while c <= a: dfs(p + 1, c) c *= lst[p] else: dfs(p + 1, c) c *= lst[p] if c <= a: dfs(p + 1, c) dfs(0, 1) print(ans - 2)