while True:
try:
n=int(input())
num =0
for i in range(1,n+1):
s=[]
for j in range(1,i+1):
if i%j==0 and i!=j:
s.append(j)
if i== sum(s):
num+=1
print(num)
except:
break