n = int(input())
if n <= 2:
print(0)
else:
r = 0
for i in range(3, n):
k = [1]
for j in range(2, i):
if not i % j:
k.append(j)
if sum(k) == i:
r += 1
print(r)
n = int(input())
if n <= 2:
print(0)
else:
r = 0
for i in range(3, n):
k = [1]
for j in range(2, i):
if not i % j:
k.append(j)
if sum(k) == i:
r += 1
print(r)