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