def check_perfect(n): m = 0 for i in range(1,n): if n % i == 0: m += i return m

while True: try: s = int(input()) c = 0 for i in range(2, s+1): if i == check_perfect(i): c += 1 print(c) except: break