# 判断一个数是不是完全数
def wq(n):
flag = False
num = 0 # 存储整数n的约数的和
for i in range(1, n):
if n % i == 0:
num += i
if num == n:
flag = True
return flag
while True:
try:
n = int(input())
re = 0 # 存储完全数的个数
for i in range(1, n + 1):
if wq(i):
re += 1
print(re)
except:
break