import sys

def is_wqs(key):
    sum = 0
    for i in range(1, key):
        if key % i == 0:
            sum = sum + i

    if sum==key:
        return 1


data = int(sys.stdin.readline())

count=0
for i in range(2,data):
    if is_wqs(i)==1:
        count=count+1

print(count)