def perfectNumber(n): s = 0 for i in range(1,int(n**0.5)+1): if n % i == 0: a = n/i s += i s += a if s == 2*n: return True else: return False while True: try: n = int(input()) t = 0 for i in range(6,n): if perfectNumber(i): # print(i) t += 1 print(t) except: break